Skip to content

Throttled limit suppresses all errors #223

@r-schultz

Description

@r-schultz

Hi,

I was trying to get this gem working and ran into quite a time-consuming snag... if you use a lambda for your limit definition and it doesn't accept parameters (or accepts a different number of parameters), throttling will fail silently due to the blanket rescue here: https://github.com/ixti/sidekiq-throttled/blob/main/lib/sidekiq/throttled.rb#L92.

Example that will fail silently if the job has any parameters:

sidekiq_throttle(
  threshold: {
    limit: -> { FeatureService.feature_flag_for_throttling },
    period: 1.second
})

I wanted to see if there was a good reason for this rescue or if it could be removed? Happy to submit a PR if the latter. I generally find it bad practice to swallow errors like this since in my case it was masking a pretty simple configuration problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions