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(repeatable): allow saving custom key #1824

Merged
merged 6 commits into from
Dec 27, 2023

Conversation

roggervalf
Copy link
Collaborator

ref #1822

jobId?: string;
key?: string;
}) {
const checksum = key ? key : md5(`${name}${jobId || ''}${md5(namespace)}`);
return `repeat:${checksum}:${nextMillis}`;
// return `repeat:${jobId || ''}:${name}:${namespace}:${nextMillis}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets remove these out commented code as well 👍

@@ -10,6 +10,12 @@ export interface RepeatOptions extends Omit<ParserOptions, 'iterator'> {
* A repeat pattern
*/
pattern?: string;

/**
* Custom repeatable key
Copy link
Contributor

Choose a reason for hiding this comment

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

Complete with more information, like why is this needed:
"Custom repeatable key. This is the key that holds the "metadata" of a given repeatable job. This key is normally auto-generated but it is sometimes useful to specify a custom key for easier retrieval of repeatable jobs."

);
nextMillis: '',
namespace: repeatJobKey,
jobId: jobId || repeat.jobId,

Choose a reason for hiding this comment

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

I would recommend the use of a nullish coalescing operator jobId: jobId ?? repeat.jobId

jobId?: string;
key?: string;
}) {
const checksum = key ? key : md5(`${name}${jobId || ''}${md5(namespace)}`);

Choose a reason for hiding this comment

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

Same here

const checksum = key ?? md5(`${name}${jobId ?? ''}${md5(namespace)}`);

@EinfachHans
Copy link

This feature is really needed for me and this pr is open for quite long. Is it still planned to support this feature?

Copy link
Contributor

@manast manast left a comment

Choose a reason for hiding this comment

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

LGTM

@roggervalf roggervalf merged commit 8ea0e1f into master Dec 27, 2023
11 checks passed
@roggervalf roggervalf deleted the feat-custom-key-repeatable branch December 27, 2023 17:41
github-actions bot pushed a commit that referenced this pull request Dec 27, 2023
# [5.1.0](v5.0.0...v5.1.0) (2023-12-27)

### Features

* **job:** add isActive method [python] ([#2352](#2352)) ([afb5e31](afb5e31))
* **repeatable:** allow saving custom key ([#1824](#1824)) ([8ea0e1f](8ea0e1f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants