Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware order #194

Open
Vagab opened this issue Oct 14, 2024 · 2 comments
Open

Middleware order #194

Vagab opened this issue Oct 14, 2024 · 2 comments

Comments

@Vagab
Copy link

Vagab commented Oct 14, 2024

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

@ixti
Copy link
Owner

ixti commented Nov 9, 2024

The only middleware throttled has is responsible to finalize strategies at the end of the execution.

Can you provide a bit more details on the problem you're solving?

@ixti
Copy link
Owner

ixti commented Nov 21, 2024

As throttled jobs are not being processed - server middlewares are not executed on those. If you need some middlewares to be still executed on throttled ones, you can add observer proc that is called on each rate limiter breach. If you need "global" observer - I'll be happy to review the PR, otherwise I might add that myself when and if I will have time for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants