mastodon / flodgatt

A blazingly fast drop-in replacement for the Mastodon streaming API server
GNU Affero General Public License v3.0
87 stars 7 forks source link

Error handling, pt1 #115

Closed codesections closed 4 years ago

codesections commented 4 years ago

This PR significantly improves Flodgatt's error handling. Specifically, it converts all panics inside the redis_to_client_stream module into structured errors (with more descriptive error messages) and returns those errors until they can be handled in main, event_stream, or other high-level modules. This not only provides more user-friendly error messages, it should also prevent errors from spreading across threads. Thus, an error will now result in Flodgatt dropping a single message but will not impact other messages in that subscription, much less messages to other clients (as was previously the case).

This is Part 1 because it does not yet convert panics in the other top-level modules. Doing so should not be too difficult, since there aren't as many opportunities for errors there as when streaming from Redis. But I'm holding off on addressing that error handling until I have made the changes to Event parsing discussed in the development chat. Those changes will remove some of the error sites, so it makes sense to deal with that first.

This PR also addresses the bug that caused #114.

Additionally, this PR refactors the RedisConn struct to simplify the API (in work related to #112)