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

fix(events-producer): serialize and deserialize custom events #2987

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

roggervalf
Copy link
Collaborator

@roggervalf roggervalf commented Dec 29, 2024

Why

Enter your explanation here.

How

Enter the implementation details here.

Additional Notes (Optional)

Any extra info here.
Ignore events that do not need this deserialization as the ones that we handled internally in this package
ref #2984

case 'stalled':
case 'waiting':
case 'waiting-children':
break;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

avoid to do a deserialization for these events that do not need it

Copy link
Contributor

Choose a reason for hiding this comment

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

Fastest here would be to use a Set object that is global for this module and that provides fast check for membership.

@roggervalf roggervalf force-pushed the event-producer-fix-args-stringify branch from a2d6d5c to 115e528 Compare January 11, 2025 13:12
@@ -40,7 +40,7 @@ export class QueueEventsProducer extends QueueBase {
const args: any[] = ['MAXLEN', '~', maxEvents, '*', 'event', eventName];

for (const [key, value] of Object.entries(restArgs)) {
args.push(key, value);
args.push(key, JSON.stringify(value));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we are digging ourselves more into this rabbit hole, as it would have been much simpler to just allow sending strings as payloads for the custom events and let the user serialize and deserialise as they see fit, this will never be satisfactory for all cases out there...

@roggervalf roggervalf force-pushed the event-producer-fix-args-stringify branch from 115e528 to 23be50e Compare January 14, 2025 01:42
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.

2 participants