Use builtin library and add test to verify that delay is actually delaying#613
Open
phillipperalez wants to merge 2 commits intomasterfrom
Open
Use builtin library and add test to verify that delay is actually delaying#613phillipperalez wants to merge 2 commits intomasterfrom
phillipperalez wants to merge 2 commits intomasterfrom
Conversation
jimbert
reviewed
Jul 22, 2024
| flush(buffer: sheets_v4.Schema$BatchUpdateSpreadsheetRequest, sheet: Sheet, spreadsheetId: string, webhookId: string): Promise<import("gaxios").GaxiosResponse<sheets_v4.Schema$BatchUpdateSpreadsheetResponse>>; | ||
| flushRetry(buffer: sheets_v4.Schema$BatchUpdateSpreadsheetRequest, sheet: Sheet, spreadsheetId: string, webhookId: string): Promise<import("gaxios").GaxiosResponse<sheets_v4.Schema$BatchUpdateSpreadsheetResponse>>; | ||
| protected delay(time: number): Promise<void>; | ||
| delay(time: number): Promise<void>; |
Contributor
There was a problem hiding this comment.
What effect are you achieving here?
Contributor
Author
There was a problem hiding this comment.
it doesn't particularly matter and then I can actually test the function
jimbert
reviewed
Jul 22, 2024
| }) | ||
|
|
||
| describe("delay", () => { | ||
| it("will block on await delay", async () => { |
Contributor
There was a problem hiding this comment.
Can you provide more detail for why this is necessary?
Contributor
Author
There was a problem hiding this comment.
the previous implementation, although it looked correct, was not actually delaying retries. I am seeing another area which I missed so I will upload another change to this as well
jimbert
reviewed
Jul 22, 2024
| describe("delay", () => { | ||
| it("will block on await delay", async () => { | ||
| const start = Date.now() | ||
| await action.delay(100) |
jimbert
reviewed
Jul 22, 2024
| const start = Date.now() | ||
| await action.delay(100) | ||
| const end = Date.now() | ||
| chai.expect(end - start).to.be.greaterThanOrEqual(10) |
jimbert
reviewed
Jul 22, 2024
| await new Promise<void>((resolve) => { | ||
| setTimeout(resolve, time) | ||
| }) | ||
| async delay(time: number) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous Promise didn't appear to actually be applying delays