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

Refactor scripts class #1240

Merged
merged 8 commits into from
May 14, 2022
Merged

Refactor scripts class #1240

merged 8 commits into from
May 14, 2022

Conversation

roggervalf
Copy link
Collaborator

No description provided.

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.

Looks good to me, just a small question.

@@ -430,7 +430,7 @@ export class Worker<
token: string,
jobId?: string,
): Promise<Job<DataType, ResultType, NameType>> {
const [jobData, id] = await Scripts.moveToActive(this, token, jobId);
const [jobData, id] = await this.scripts.moveToActive(this, token, jobId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is needed to pass "this" in this case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, here it was missing that change, in last commit should be addressed

@roggervalf roggervalf requested a review from manast May 13, 2022 05:06
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.

Looks good, a smal comment.

}
}

toJSON() {
const { queue, ...withoutQueue } = this;
const { queue, scripts, ...withoutQueue } = this;
Copy link
Contributor

Choose a reason for hiding this comment

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

now it should be called: withoutQueueAndScripts. :).
In general, I think this pattern can lead to bugs because it is easy to forget to remove what you do not want and end the serialization of unneeded things. Even if more tedious, it is probably better to manually select the properties you want to serialize.

@roggervalf roggervalf merged commit 87a16f0 into master May 14, 2022
@roggervalf roggervalf deleted the refactor-scripts-class branch May 14, 2022 03:58
@github-actions
Copy link

🎉 This PR is included in version 1.82.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants