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

Documents WorkerEvents #446

Merged
merged 3 commits into from
Apr 2, 2024
Merged

Documents WorkerEvents #446

merged 3 commits into from
Apr 2, 2024

Conversation

ThHareau
Copy link
Contributor

@ThHareau ThHareau commented Mar 7, 2024

Description

I was having trouble understanding how worker events could be used inside the configuration file. The example provided in #385 helped me.

I figured that since we were at least two not understanding how EventEmitter should be used, it might be useful to other to add these examples to the documentation.

Tell me what you think of this PR 🙂

Performance impact

None, documentation only

Security impact

None, documentation only

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

@ThHareau ThHareau changed the title Hi, I was having trouble understanding how worker events could be used inside the configuration file. The example provided in https://github.com/graphile/worker/issues/385 helped me. I figured that since we were at least two not understanding how EventEmitter should be used, it might be useful to other to add these examples to the documentation. Tell me what you think of this PR 🙂 fix #385: Documents WorkerEvents Documents WorkerEvents Mar 7, 2024
@ThHareau ThHareau marked this pull request as ready for review March 7, 2024 10:07
Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

Excellent! Since you can do this from the config now, it's no longer library-only; please move it to website/docs/worker-events.md and make any necessary updates to the other files. Thanks!

website/docs/library/worker-events.md Outdated Show resolved Hide resolved
website/docs/library/worker-events.md Outdated Show resolved Hide resolved
website/docs/library/worker-events.md Outdated Show resolved Hide resolved
Copy link
Contributor Author

@ThHareau ThHareau left a comment

Choose a reason for hiding this comment

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

thanks @benjie! I've addressed your comments

Comment on lines 124 to 127
/**
* When a worker is created
*/
"worker:fatalError": { worker: Worker; error: any; jobError: any | null };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also I've noticed that this comment is probably wrong. Do you have a suggestion for a better documentation?

I had a look at the code, is it when the worker cannot be created? In that case, what would you think of this proposition?

Suggested change
/**
* When a worker is created
*/
"worker:fatalError": { worker: Worker; error: any; jobError: any | null };
/**
* When a worker cannot be created because of an unhandled error
*/
"worker:fatalError": { worker: Worker; error: any; jobError: any | null };

@ThHareau
Copy link
Contributor Author

ThHareau commented Apr 2, 2024

@benjie did you had a chance to take a look?

website/docs/worker-events.md Show resolved Hide resolved
website/docs/worker-events.md Show resolved Hide resolved
website/docs/worker-events.md Show resolved Hide resolved
website/docs/worker-events.md Show resolved Hide resolved
website/docs/worker-events.md Outdated Show resolved Hide resolved
benjie
benjie previously approved these changes Apr 2, 2024
Copy link
Member

@benjie benjie 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 - thanks! 🙌

@benjie benjie merged commit c370caa into graphile:main Apr 2, 2024
14 checks passed
@benjie
Copy link
Member

benjie commented Apr 2, 2024

Live here: https://worker.graphile.org/docs/worker-events 🙌

@ThHareau ThHareau deleted the doc-worker-events branch April 2, 2024 11:43
@ThHareau
Copy link
Contributor Author

ThHareau commented Apr 2, 2024

That's great! Thanks @benjie!

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