Bogdanp/dramatiq

Feature Request: Considering handling a SkipEnqueue MiddlewareError

Aperta

#276 aperta il 26 feb 2020

 (1 commento) (0 reazioni) (0 assegnatari)Python (277 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (3884 stelle)
Metriche merge PR
 (Merge medio 20g 20h) (10 PR mergiate in 30 g)

Descrizione

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.

Guida contributor