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

make the state file an optional feature; fix some comments #19

Merged
merged 2 commits into from
Jun 17, 2015

Conversation

theckman
Copy link
Collaborator

The state file is great for tasks where you plan on coming back later to verify the state of the job. However, if you want to have a handler for a fire-and-forget event it becomes a bit troublesome. If you don't reap the state file, subsequent events will silently fail. Because it is a fire-and-forget event, the failures are then widespread and silent.

I didn't see any assertions against the state file itself, so let me know if there's anything you'd like me to enhance there.

Lastly, fixed some typos in some of the comments.

To note: beyond a compilation check, ruby -c, this hasn't been thoroughly tested. I don't have an environment locally to do so, just yet.

The state file is great for tasks where you plan on coming back later to verify the state of the job. However, if you want to have a handler for a fire-and-forget event it becomes a bit troublesome. If you don't reap the state file, subsequent events will silently fail. Because it is a fire-and-forget event, the failures are then widespread and silent.

I didn't see any assertions against the state file itself, so let me know if there's anything you'd like me to enhance there.

Lastly, fixed some typos in some of the comments.
end

# writes a hash as json in the state_file
# @param [Hash] state represented as a hash, to be written
def write_state(state)
File.open(state_file, 'w') do |f|
f.write(JSON.generate(state))
unless state_file.nil?
Copy link
Owner

Choose a reason for hiding this comment

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

change this to just if state_file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍

@ranjib
Copy link
Owner

ranjib commented Jun 17, 2015

LGTM

@ranjib
Copy link
Owner

ranjib commented Jun 17, 2015

@theckman can you nuke ruby 1.9.3 from travis config as well :-)
thank you

@theckman
Copy link
Collaborator Author

Absolutely. I've fixed some more comments, altered the guard around file writing code, and removed 1.9.3 from the build matrix.

ranjib added a commit that referenced this pull request Jun 17, 2015
make the state file an optional feature; fix some comments
@ranjib ranjib merged commit 2770308 into ranjib:master Jun 17, 2015
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.

None yet

2 participants