Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(New) Synchronous Pull with Lease Management #272

Merged
merged 7 commits into from
Sep 28, 2018
Merged

(New) Synchronous Pull with Lease Management #272

merged 7 commits into from
Sep 28, 2018

Conversation

anguillanneuf
Copy link
Contributor

This new code sample for synchronous pull with lease management aims to keep the Pub/Sub logic and the application logic separate, by

1). creating the long running process outside in a worker function, and using setTimeout to simulate this process of unknown length;
2). making use of setInterval instead of a for loop.

Here is what the stdout would look like:

Processing "hello me" for 60.227s...
Processing "hello him" for 95.585s...
Reset ack deadline for "hello me" for 30s.
Reset ack deadline for "hello him" for 30s.
Reset ack deadline for "hello me" for 30s.
Reset ack deadline for "hello him" for 30s.
Reset ack deadline for "hello me" for 30s.
Reset ack deadline for "hello him" for 30s.
Reset ack deadline for "hello me" for 30s.
Reset ack deadline for "hello him" for 30s.
Reset ack deadline for "hello me" for 30s.
Reset ack deadline for "hello him" for 30s.
Reset ack deadline for "hello me" for 30s.
Reset ack deadline for "hello him" for 30s.
Finished procesing "hello me".
Acknowledged: "hello me".
Reset ack deadline for "hello him" for 30s.
Reset ack deadline for "hello him" for 30s.
Reset ack deadline for "hello him" for 30s.
Finished procesing "hello him".
Acknowledged: "hello him".
Done.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 28, 2018
@codecov
Copy link

codecov bot commented Sep 28, 2018

Codecov Report

Merging #272 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #272   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10     10           
  Lines         807    807           
=====================================
  Hits          807    807

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6780a97...63cbf43. Read the comment docs.

@JustinBeckwith JustinBeckwith merged commit 1f0a9be into googleapis:master Sep 28, 2018
@anguillanneuf anguillanneuf deleted the syncpull branch November 2, 2018 17:07
feywind pushed a commit to feywind/nodejs-pubsub that referenced this pull request Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants