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

Checking the current actor is running not just that it is alive #121

Closed
wants to merge 1 commit into from
Closed

Conversation

brand-it
Copy link
Contributor

@brand-it brand-it commented Nov 9, 2016

The check for the alive should stay as it could be running but not
alive which is not likely but possible.

@brand-it
Copy link
Contributor Author

brand-it commented Nov 9, 2016

@dblock Can you review this to support #110

@dangerpr-bot
Copy link

dangerpr-bot commented Nov 9, 2016

1 Warning
⚠️ There’re library changes, but not tests. That’s OK as long as you’re refactoring existing code.

Generated by 🚫 danger

@dblock
Copy link
Collaborator

dblock commented Nov 9, 2016

Is alive? and running? redundant?

Is there a way we can write a test for this?

Needs a CHANGELOG entry either way.

@brand-it
Copy link
Contributor Author

brand-it commented Nov 9, 2016

based on the code they are not even checking the same information.

https://github.com/celluloid/celluloid/blob/master/lib/celluloid/task.rb#L133

running? seams to check the status of the job. where alive is just checking if there is a actor.

https://github.com/celluloid/celluloid/blob/master/lib/celluloid/mailbox.rb#L107

however if you don't check alive it will raise an error that says celluloid has to be alive.

https://github.com/celluloid/celluloid/blob/master/lib/celluloid/proxy/actor.rb#L34

That check is not wrong but just extra insurance to make sure we don't terminate something that can't be terminated. Really it does not harm anything and if anything it is making things much more safe.

@brand-it
Copy link
Contributor Author

brand-it commented Nov 9, 2016

Also tested this out on the server that was giving my the connection refused and it no longer gives me that error.

Here is some code of a terminate that does a better job of checking if can be terminated.

https://github.com/celluloid/celluloid/blob/master/lib/celluloid/task.rb#L108

@brand-it
Copy link
Contributor Author

brand-it commented Nov 9, 2016

As for a test I not total sure if there is a way to make it happen. As the bug that was created was caused by a firewall blocking the network connection making the web socket throw a connection refused error.

This would be really trick to make happen in a test but it is not impossible. Will have to spend some time thinking about how to reproduce the bug.

@@ -4,6 +4,7 @@
* [#116](https://github.com/slack-ruby/slack-ruby-client/pull/116): Use [slack-ruby/slack-api-ref](https://github.com/slack-ruby/slack-api-ref) as machine API reference - [@dblock](https://github.com/dblock).
* [#116](https://github.com/slack-ruby/slack-ruby-client/pull/116): Added `users_setPhoto` and `users_deletePhoto` to Web API - [@dblock](https://github.com/dblock).
* [#81](https://github.com/slack-ruby/slack-ruby-client/pull/81): Require faraday 0.9.0 or newer - [@leppert](https://github.com/leppert).
* [#121](https://github.com/slack-ruby/slack-ruby-client/pull/121): Checking the current actor is running before calling terminate
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please fix the format for this? Needs your name at the end with a period and all ...

The check for the alive should stay as it could be running but not
alive which is not likely but possible.
@dblock
Copy link
Collaborator

dblock commented Nov 27, 2016

I'd like to merge this, it needs to be rebased. Also any ideas about a test @NewDark? Maybe a connection against a server that doesn't exist?

@brand-it
Copy link
Contributor Author

Yes total forgot about this work. Thanks for the reminder. I think that moving work I will have to test into out. I also noticed that there was no tests for this file is there a style guide to follow for writing tests?

@dblock
Copy link
Collaborator

dblock commented Nov 28, 2016

Sorry no style guide. There should be tests for everything obviously.

@brand-it
Copy link
Contributor Author

brand-it commented Dec 1, 2016

@dblock

Ok I will make sure to get this all corrected. Been a bit busy but once I get some free time I can have it done.

@dblock
Copy link
Collaborator

dblock commented Jan 24, 2017

Bump @NewDark

@brand-it
Copy link
Contributor Author

Sorry I have been a bit over worked with my job @dblock I have not had time to come back to work on this :(

@dblock
Copy link
Collaborator

dblock commented Mar 8, 2017

I failed to write a good test for this, so I am going to merge via #137.

@dblock dblock closed this Mar 8, 2017
@dblock
Copy link
Collaborator

dblock commented Apr 30, 2017

Seeing #146, what changed on Actor not to have running? anymore or am I missing something?

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.

3 participants