Repository navigation
Conversation
This branch has not been deployed
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.
Problem
The local CronJob mock creates a new
Intl.DateTimeFormatfor every minute it checks when searching for the next occurrence in a time zone. This adds synchronous startup work for sparse schedules even though all candidates use the same formatter options.Issue #, if available: N/A
Changes
Validation
mainbecause a single weekly search constructs a formatter for each candidate minute. With the fix it constructs one, and the job still fires at the expected instant. A second test checks that jobs in Tokyo and Kolkata use their own time zones.Asia/Tokyojob just after its January occurrence took about 1.16 seconds onmainand 0.09 seconds with this change. Both builds selected the same February occurrence. The regression test checks formatter allocations and scheduled times, not wall-clock latency.IS_WEBPACK_TEST=1 npm run build,npm run lint,npm run lint:deps,npm test -w @aws-blocks/bb-cron-job,npm run check:api, and changeset guards.npm run test:e2e:localandgit diff --check origin/main...HEAD.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.