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

feat: allow schedulers to run in a single node #6794

Merged
merged 10 commits into from
Apr 10, 2024
Merged

Conversation

gastonfournier
Copy link
Contributor

@gastonfournier gastonfournier commented Apr 8, 2024

About the changes

This PR provides a service that allows a scheduled function to run in a single instance. It's currently not in use but tests show how to wrap a function to make it single-instance:

const job = service.singleInstance(
'test',
async () => {
counter++;
},
60,
);

The key 'test' is used to identify the group and most likely should have the same name as the scheduled job.

codescene-delta-analysis[bot]

This comment was marked as off-topic.

src/migrations/20240405174629-jobs.js Outdated Show resolved Hide resolved
src/migrations/20240405174629-jobs.js Outdated Show resolved Hide resolved
src/migrations/20240405174629-jobs.js Outdated Show resolved Hide resolved
codescene-delta-analysis[bot]

This comment was marked as spam.

codescene-delta-analysis[bot]

This comment was marked as spam.

codescene-delta-analysis[bot]

This comment was marked as spam.

codescene-delta-analysis[bot]

This comment was marked as spam.

codescene-delta-analysis[bot]

This comment was marked as spam.

codescene-delta-analysis[bot]

This comment was marked as spam.

@gastonfournier gastonfournier marked this pull request as ready for review April 10, 2024 09:00
codescene-delta-analysis[bot]

This comment was marked as spam.

@gastonfournier gastonfournier changed the title feat: PoC leader election feat: allow schedulers to run in a single node Apr 10, 2024
@Unleash Unleash deleted a comment from vercel bot Apr 10, 2024
@gastonfournier
Copy link
Contributor Author

cc @kwasniew @sjaanus just FYI cause it's related to schedulers. Maybe you have a candidate for this functionality, but first we're going to test it in enterprise customers with the feature we are developing. Maybe we can wait until it's actually tested to use it elsewhere but just keep it in mind ;)

Copy link
Contributor

@chriswk chriswk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the slight mismatch in our down migration, this looks good to me.

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Copy link

vercel bot commented Apr 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Apr 10, 2024 9:27am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Apr 10, 2024 9:27am

codescene-delta-analysis[bot]

This comment was marked as spam.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: FAILED

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 1 findings(s) ✅
  • Affected Hotspots: 1 files(s) 🔥

View detailed results in CodeScene

() => {
clientMetricsServiceV2.bulkAdd().catch(console.error);
},
() => clientMetricsServiceV2.bulkAdd().catch(console.error),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Getting better: Large Method
scheduleServices decreases from 137 to 133 lines of code, threshold = 70

@gastonfournier gastonfournier merged commit 0a2d40f into main Apr 10, 2024
7 of 8 checks passed
@gastonfournier gastonfournier deleted the leader-election-poc branch April 10, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants