Bogdanp/dramatiq

Feature Request: Considering handling a SkipEnqueue MiddlewareError

開放

#276 建立於 2020年2月26日

 (1 則留言) (0 個反應) (0 位負責人)Python (277 個分叉)batch import
enhancementhelp wanted

倉庫指標

星標
 (3,884 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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.

貢獻者指南