1. 2

  2. 1

    I don’t understand how this could work:

    lock_id = throttler.get_lock("example.com", limit: 10, expires_in: 2.minutes)
    if lock_id
      # perform the job here
      # delay the job

    get_lock always returns SecureRandom.hex(5) from what I tell.

    1. 1

      @Stratus3D the unique_key option was added so that we can track jobs by giving it our own unique key. So for xyz.com:123abc, where xyz.com is the facet and123abc is the unique key (and the ID of an item in our db), we know that the item ID being processed is 123abc for the xyz.com site.

      As a good side-effect, I later realized that if I use the nx option when inserting a key along with the unique_key option, then I could avoid jobs running for the same item at the same time.