Not sure if this is expected or not, but while trying to work with this gem I found myself needing to customize the order in which middlewares are run. And I need throttled middleware to run after a particular middleware. Now the problem is that the throttled middleware still runs before every other middleware. I did a little bit of investigation and what I found is this, let me know if it makes sense:
In sidekiq when you perform_async the job will later be processed by processor.rb, but that will actually run the middleware after fetching the job, but before processing. And ThrottledFetcher overrides the fetch so that it checks whether the job has to be processed before it is actually processed(which makes sense) but it makes the middleware order useless
Not sure if this is expected or not, but while trying to work with this gem I found myself needing to customize the order in which middlewares are run. And I need
throttledmiddleware to run after a particular middleware. Now the problem is that thethrottledmiddleware still runs before every other middleware. I did a little bit of investigation and what I found is this, let me know if it makes sense:In sidekiq when you
perform_asyncthe job will later beprocessedbyprocessor.rb, but that will actually run the middleware afterfetching the job, but beforeprocessing. AndThrottledFetcheroverrides thefetchso that it checks whether the job has to be processed before it is actually processed(which makes sense) but it makes the middleware order useless