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 合并指标
 (平均合并 20天 20小时) (30 天内合并 10 个 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.

贡献者指南