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

Set blacklisted exceptions #12

Open
wants to merge 7 commits into
base: skroutz
Choose a base branch
from

Conversation

konstantinoskostis
Copy link

@konstantinoskostis konstantinoskostis commented Aug 2, 2019

This pull request allows accessing/modifying of a blacklist of exceptions of a Resque Failure backend
which is a class variable of a Resque::Failure::Base class. So, each backend by calling set_blacklisted_exceptions on the class, can set its monitored blacklisted exceptions and this is independent of the backend class (e.g Redis might have its own exceptions and a RedisMultiQueue might have its own and they can also later be added to a Multiple backend if a user needs many failure backends)

@konstantinoskostis konstantinoskostis self-assigned this Aug 2, 2019
@konstantinoskostis konstantinoskostis force-pushed the set_blacklisted_exceptions_improved branch from cf5ae54 to 1389fb1 Compare August 2, 2019 08:03
@konstantinoskostis konstantinoskostis force-pushed the set_blacklisted_exceptions_improved branch from 1389fb1 to 97469bf Compare August 2, 2019 10:07
@0xdiba 0xdiba changed the title Set blacklisted exceptions improved Set blacklisted exceptions Aug 2, 2019
lib/resque/failure/multiple.rb Outdated Show resolved Hide resolved
lib/resque/failure/blacklist_exceptions_registrar.rb Outdated Show resolved Hide resolved
test/resque_failure_multiple_test.rb Outdated Show resolved Hide resolved
This commit introduces a new module for accessing a class variable
named `blacklist`. This class variable represents exceptions that
will not be pushed to the failed queue when a job fails with an
exception that is included in the blacklist.
Every class that includes this module can access/manipulate its
`blacklist` class variable.
Also it adds a method called `blacklisted_exception_raised?` which
checks if the raised exception belongs to the backend's blacklisted
exceptions.
This commit allows Resque::Failure::Base to include the module
BlacklistExceptionsRegistrar and by extension allowing every
descendant of base class to manipulate its `blacklist` class
variable.
@konstantinoskostis konstantinoskostis force-pushed the set_blacklisted_exceptions_improved branch from 97469bf to bae2706 Compare August 5, 2019 09:28
@konstantinoskostis
Copy link
Author

@dblia @eavgerinos changes have been made, re-review at your earliest convenience

Copy link

@dblia dblia left a comment

Choose a reason for hiding this comment

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

👍

This commit uses the `blacklisted_exception_raised?`, provided
by the BlacklistExceptionsRegistrar module, to determine
if the raised exception of the failed job is a blacklisted
exception and by extension if the job should be pushed to
the failed queue or not.
This commit uses the `blacklisted_exception_raised?`, provided
by the BlacklistExceptionsRegistrar module, to determine
if the raised exception of the failed job is a blacklisted
exception and by extension if the job should be pushed to
the failed queue or not.
This commit uses the `blacklisted_exception_raised?`, provided
by the BlacklistExceptionsRegistrar module, to determine
if the save method of a respective backend should be called
or not if a failed job with a given exception occurs.
@konstantinoskostis konstantinoskostis force-pushed the set_blacklisted_exceptions_improved branch from bae2706 to d1e090d Compare August 5, 2019 10:31
@konstantinoskostis
Copy link
Author

@dblia @eavgerinos a few more tests are added for redis test file, so now all methods in the registrar module are tested!

@konstantinoskostis konstantinoskostis force-pushed the set_blacklisted_exceptions_improved branch from d1e090d to c5e6fed Compare August 5, 2019 12:17
@konstantinoskostis konstantinoskostis force-pushed the set_blacklisted_exceptions_improved branch from c5e6fed to 4ff4dad Compare August 5, 2019 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants