Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

Question about handling disconnects. #19

Open
jcdesimp opened this issue Feb 12, 2015 · 2 comments
Open

Question about handling disconnects. #19

jcdesimp opened this issue Feb 12, 2015 · 2 comments

Comments

@jcdesimp
Copy link

When connection is lost to the server, the piepan instance exits which I think is logical and should stay. However I was wondering if there was some way to handle a disconnect event for things like having the bot attempt to reconnect X number of times. On a semi related note, there doesn't seem to be a disconnect type for when a user is kicked.

What I'm mainly asking for is if theres some way to tell the bot to reconnect before it completes the disconnect event, and if that reconnection is successful then to cancel the disconnect event. Any helpful info you might be able to provide would be much appreciated, thank you.

@ghost
Copy link

ghost commented Feb 12, 2015

As of fcc7d85, the disconnect type is reported through piepan's exit code.

I do not know if I am going to add auto reconnection or not, but you should be able to do it using a simple shell script:

while ! piepan ...; do
  sleep 5
done

@ghost ghost added the feature-request label Feb 12, 2015
@jcdesimp
Copy link
Author

@bontibon Ok, I suppose that script should be suitable for now. As far as the "feature request" goes, I think the ability to script the bot to reconnect would be more desirable than simply built-in auto reconnect functionality. This way any variables in the programs still hold their values. So things like connection attempts can be tracked internally and such. Some way to reconnect via a disconnect event handler that can prevent the disconnect from happening.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant