Skip to content

Fix: make sure plugin can be stop-ed #87

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

Closed
wants to merge 20 commits into from

Conversation

kares
Copy link
Contributor

@kares kares commented Apr 7, 2021

Currently not all specs from the suite are run, as some are tagged with redis.
These require a real Redis server, no reason not to run them against CI as well.

While getting CI to run the rest of the suite I realized the plugin isn't always interruptible.
In case of data_type => channel and data_type => pattern_channel the Redis API used is blocking (simply waits forever until more data comes in) thus the change to use an alternative "timeout" APIs with these.

@kares kares force-pushed the test-redis-integ branch from 934e998 to 5adad05 Compare April 8, 2021 07:05
end

TIMEOUT = 5 # Redis only supports Integer values
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this timeout is internal for the redis (read/write) operation, we catch TimeoutError and retry in a loop,
provides a way for interrupting the input.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have multiple timeouts here in layers, it would be helpful to name this something distinct.

Suggested change
TIMEOUT = 5 # Redis only supports Integer values
BLOCKING_CALL_TIMEOUT = 5 # Redis only supports Integer values

@kares kares changed the title Test: fix and run "integration" specs (using Redis) Fix: make sure plugin can be stop-ed in case of a channel data_type Apr 13, 2021
@kares kares changed the title Fix: make sure plugin can be stop-ed in case of a channel data_type Fix: make sure plugin can be stop-ed Apr 13, 2021
Copy link
Contributor

@yaauie yaauie left a comment

Choose a reason for hiding this comment

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

I think fundamentally, we need to allow the blocking operations on pub/sub and to find a way to kill them from the outside if they are still running when the plugin is stopped.

Otherwise, we invite the race condition where low-volume topics end up missing events because they arrive on the topic in the window between one subscription timing out and the input re-attempting to subscribe.

end

TIMEOUT = 5 # Redis only supports Integer values
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have multiple timeouts here in layers, it would be helpful to name this something distinct.

Suggested change
TIMEOUT = 5 # Redis only supports Integer values
BLOCKING_CALL_TIMEOUT = 5 # Redis only supports Integer values

# in a while !stop? loop
sleep 1
rescue => e
retry if handle_error(e)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: I would expect a method called handle_error to return true if the error had been handled, but the way that we retry here indicates the opposite.

@kares kares marked this pull request as draft April 14, 2021 07:03
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.

4 participants