-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Add first cut at Performer
docs
#112
Conversation
Co-Authored-By: Rob Brackett <74178+mr0grog@users.noreply.github.com>
847b95d
to
5f97faa
Compare
5f97faa
to
9711a3d
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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".
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.