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

Add first cut at Performer docs #112

Conversation

Mr0grog
Copy link
Contributor

@Mr0grog Mr0grog commented Aug 28, 2020

I took a few minutes to go through Performer and attempt to document it after we finished talking this afternoon. Feel free to use or toss!

Note: this is targeted at the code_docs branch for #111.

Co-Authored-By: Rob Brackett <74178+mr0grog@users.noreply.github.com>
@Mr0grog Mr0grog force-pushed the performer-does-things-you-might-want-to-know-about branch from 847b95d to 5f97faa Compare August 28, 2020 23:04
@Mr0grog Mr0grog force-pushed the performer-does-things-you-might-want-to-know-about branch from 5f97faa to 9711a3d Compare August 28, 2020 23:06
Copy link
Owner

@bensheldon bensheldon left a comment

Choose a reason for hiding this comment

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

Thanks! 😊 I added a little more explanation in the comments. I'll trust you whether you think it should be worked in or not.

@@ -1,18 +1,46 @@
module GoodJob
#
# Performer queries the database for jobs and performs them on behalf of a
Copy link
Owner

Choose a reason for hiding this comment

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

This is the applied purpose for the Perfomer. Though the performer is intended to be generic/ignorant of the nature of the task.

The practical reason for the performer is to enforce a callable that does not rely on scoped/closures variables because they might not be available when executed in a different thread. Or alternatively, it describes an interface that is compatible with the Scheduler.

def next
@target.public_send(@method_name)
end

# Tests whether this performer should be used in GoodJob's current state by
Copy link
Owner

Choose a reason for hiding this comment

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

"State" is the generic. Practically, the state is a LISTEN/NOTIFY message that is passed down from the Notifier to the Scheduler, and the Scheduler then is able to ask the Performer "does this message relate to you?" and allow the Performer to say "no, don't bother waking up thread".

@bensheldon bensheldon merged commit 6fffc1a into bensheldon:code_docs Aug 30, 2020
@bensheldon bensheldon added the documentation Improvements or additions to documentation label Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants