Bogdanp/dramatiq

Feature Request: Considering handling a SkipEnqueue MiddlewareError

Open

#276 opened on Feb 26, 2020

 (1 comment) (0 reactions) (0 assignees)Python (277 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (3,884 stars)
PR merge metrics
 (Avg merge 20d 20h) (10 merged PRs in 30d)

Description

I've just implemented a "DedupMiddleware" which can be used prevent a message from being enqueued if a similar message already exists in the queue. Unfortunately it requires to override RedisBroker.enqueue() in order to gracefully catch the SkipEnqueue middleware error I raise when needed.

Would you consider accepting a PR that would:

  1. Define a SkipEnqueue(MiddlewareError).
  2. try...except this error around self.emit_before here, so a middleware could be given the possibility to interrupt an enqueuing in that hook?

Thanks.

Contributor guide