1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
Commit graph

1801 commits

Author SHA1 Message Date
Mike Perham
cd553fa14c revert kwarg support 2022-01-31 13:17:46 -08:00
Mike Perham
b56195155d Revert "Fix an error when job was enqueued without kwargs () ()"
This reverts commit 24fb5d3e50.
2022-01-31 13:15:46 -08:00
Thach Chau
10e7feb312
Add keyword arguments handler in Sidekiq::JobRecord#display_args ()
* Add keyword arguments handler in Sidekiq::JobRecord#display_args

* Update Sidekiq::JobRecord#display_args kwargs's presence check so that we are not dependent on Rails.
2022-01-29 09:04:29 -08:00
Mike Perham
8ee13c703d changes 2022-01-27 08:45:13 -08:00
Mike Perham
b65a932ae6 Include display_class in set of UI-ignored keys 2022-01-26 17:02:02 -08:00
Mike Perham
01686c5e25 Tweak job logger to reduce overhead, 3-4% speedup 2022-01-26 16:57:43 -08:00
Peter Goldstein
860c7b1909
Load aliases for Psych 4 (included in Ruby 3.1) () 2022-01-24 13:32:36 -08:00
Nathan Le Ray
24fb5d3e50
Fix an error when job was enqueued without kwargs () () 2022-01-24 13:31:30 -08:00
Jean byroot Boussier
c792342753
Fix deprecated uses of Redis#pipelined and Redis#multi ()
Context: https://github.com/redis/redis-rb/pull/1059

The following is deprecated
```ruby
redis.pipelined do
  redis.get(key)
end
```

And should be rewritten as:
```ruby
redis.pipelined do |pipeline|
  pipeline.get(key)
end
```

Functionally it makes no difference.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2022-01-24 08:18:16 -08:00
mikit
34d081f4ed
Fix the pool used by perform_bulk ()
* Fix the pool used by perform_bulk

* Fix missing receiver

* Fix missing kwargs
2022-01-21 08:16:25 -08:00
Mike Perham
7f6b2efe20 Bump minor as there are significant changes 2022-01-20 10:47:00 -08:00
Mike Perham
7785ac1399 Validate days parameter to avoid possible DoS in Web UI
Thank you to Sergey Shpakov of http://tutum.space for reporting.
2022-01-20 10:42:26 -08:00
Nathan Le Ray
0a4de94d76
Add keyword arguments support in extensions ()
* Add keyword arguments support in extensions

* Check that keywords arguments are passed

* Test perform calls with keyword arguments

* Fix kwargs forwarding on Ruby 2.6
2022-01-18 07:55:31 -08:00
Mike Perham
63f6e68777 standard formatting 2022-01-05 21:01:32 -08:00
Mike Perham
96ac8e7c6a bump 2022-01-05 19:56:04 -08:00
Mike Perham
cea266a72f Better method naming, 2022-01-05 19:54:12 -08:00
Mike Perham
f7e1fc83b4 Pause hard shutdown to give time for ensure cleanup, fixes
If we raised Sidekiq::Shutdown in job threads, sleep for a while
so they have time to run `ensure` blocks. Right now we immediately
return from hard_shutdown and call `exit` which immediately raises SystemExit on every thread which can stop ensure blocks.
2021-12-14 11:53:00 -08:00
Mike Perham
c92a521f2c Merge new attributes if existing attributes, fixes 2021-12-09 13:14:59 -08:00
Mike Perham
615393d794 RDoc improvements 2021-12-09 13:06:29 -08:00
Mike Perham
41493f2623 Stringify perform_bulk's option hash, fixes 2021-12-07 14:02:59 -08:00
Mike Perham
b0fd83f5fc Rejigger complex argument handling,
Add job class name to arg message
2021-12-07 13:58:04 -08:00
Kelly Sutton
fde53a5fc1
Implement strict argument checking ()
* Add the outline of failing tests

* Implement argument checking

* Move argument checking into Sidekiq::JobUtil#validate

* Refactor acceptable class definition into a constant to cut down on array allocations

* Improve error message, match raise call formatting to other errors in the class

* Address feedback in the Pull Request to use the JSON round-trip method
of confirming the safety of job argument payloads.

Cleanup commented-out code from a few years back.

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

* Swap out JSON.load for JSON.parse per the security CI check

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

* Add a few more tests cases to build up confidence around our JSON.parse/dump approach and deep structures

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

* Improve test case description

* Warn when job arguments do not serialize safely and point folks toward how to enable strict_mode and the best practice

* Reconfigure the options-hash based approach to a global Sidekiq.strict_mode! method

* Add a note in the raised error on how to disable the error

* Let the error message breathe a little bit

* Toggle strict_mode! off to suss out a test flake

* Capitalize the start of a sentence

* Rename job_is_json_safe to json_safe?

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

* Refactor a few tests to test a single argument at a time

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

* Break out test cases to exercise each individual intersting case instead of all at once

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

* Change formatting to be more consistent, tighter when arguments are simple

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

* Add a flag to disable the warning message for development warning messages

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

Co-authored-by: Eda Zhou <eda.zhou@gusto.com>
2021-12-07 13:20:20 -08:00
Mike Perham
6877e7c23a Warn about upcoming removal, 2021-12-06 10:04:28 -08:00
Heinrich Lee Yu
e093c1b0f9
Fix deprecation warning when using redis-namespace ()
We need to call the `script` command on the raw redis connection because
passthrough for administrative commands has been deprecated and will be
removed in redis-namespace 2.0

Co-authored-by: Heinrich Lee Yu <heinrich@gitlab.com>
2021-11-23 09:13:20 -08:00
Marc-Antoine Leblond
837745ac9a
Fix stack level too deep when Sidekiq.logger == Rails.logger () 2021-11-22 09:48:30 -08:00
Mike Perham
2ed5af0a68 notes on 2021-11-16 10:40:20 -08:00
Mike Perham
283d2313a2 Merge branch 'hasan-ally-feat_sidekiq_perform_inline' 2021-11-16 10:19:50 -08:00
Mike Perham
6ae5b02236 Extract client's job utility methods, use them for perform_inline.
Sidekiq::Client is Redis-only, no inline support.
2021-11-16 10:15:14 -08:00
Kelly Sutton
e96ab6939b
Make .perform_bulk immediately evaluate lazy enumerators. ()
* Create failing tests to capture the cases we care about

Co-authored-by: Noa Elad <noa.elad@zenpayroll.com>

* Call .force on args if they are a lazy enumerator to evaluate them immediately

Co-authored-by: Noa Elad <noa.elad@zenpayroll.com>

* Change implementation of `.perform_bulk` to lazily pull values from a lazy enumerator.

This prevents us from loading the entire contents of a lazy enumerator into memory while providing the
"unsurprising" behavior of enqueueing jobs when `.perform_bulk` is called.

Note: We'll still load all JIDs into memory.

Co-authored-by: Noa Elad <noa.elad@zenpayroll.com>
Co-authored-by: Eda Zhou <eda.zhou@gusto.com>

Co-authored-by: Noa Elad <noa.elad@zenpayroll.com>
Co-authored-by: Eda Zhou <eda.zhou@gusto.com>
2021-11-16 08:54:35 -08:00
Sam Bostock
6bef01546b
Make __FILE__ and __dir__ behave as expected in ERB configs ()
* Add tests for existing ERB config __FILE & __dir__

* Allow expected usage of __FILE__ in ERB config
2021-11-15 21:08:27 -08:00
Hasan Kumar
c950470cbc
chore: move perform_inline to Sidekiq::Client to avoid unncessary set({}) 2021-11-16 03:10:38 +05:30
Hasan Kumar
2898a715d7
feat: adds support for .perform_inline which processes the job inline
after passing through available client and server middlewares
2021-11-15 15:57:56 +05:30
Heinrich Lee Yu
a486ffa555
Continue scheduling jobs when backlog jobs exist ()
When there are scheduled jobs that are due, the scheduler thread will
keep going instead of waiting for the next poll.

Co-authored-by: Heinrich Lee Yu <heinrich@gitlab.com>
2021-11-10 17:18:50 -07:00
Mike Perham
26f5f3373b Fix keyword args issue on Ruby 3.0 2021-11-06 18:12:09 -07:00
Heinrich Lee Yu
c42d941e16
Change scheduler to use Lua-based script ()
This allows us to pop jobs atomically so that we remove redundant ZREMs
from multiple processes trying to process the same job.

Co-authored-by: Heinrich Lee Yu <heinrich@gitlab.com>
2021-11-05 09:19:25 -07:00
Kelly Sutton
4a0432622f
Implement Sidekiq::Worker.perform_bulk ()
* Sketch out some failing tests to capture the behavior

Co-authored-by: jeffcarbs <jeff.carbonella@gmail.com>

* Implement Sidekiq::Client.perform_bulk

Co-authored-by: jeffcarbs <jeff.carbonella@gmail.com>

* Allow .perform_bulk to operate on different batch sizes

Co-authored-by: jeffcarbs <jeff.carbonella@gmail.com>

* Write a failing test to capture the Sidekiq::Worker::Setter.perform_bulk behavior

Co-authored-by: jeffcarbs <jeff.carbonella@gmail.com>

* Implement Sidekiq::Worker::Setter.perform_bulk

Co-authored-by: jeffcarbs <jeff.carbonella@gmail.com>

* Write a small comment for to document the method

Co-authored-by: jeffcarbs <jeff.carbonella@gmail.com>

* Add a Changes.md entry

Co-authored-by: jeffcarbs <jeff.carbonella@gmail.com>
2021-11-02 09:54:44 -07:00
Heinrich Lee Yu
fd76471cea
Use Redis.pipelined instead of Redis.multi ()
We don't need the commands here to be atomic so we use pipelined instead
to save us some overhead from MULTI

Co-authored-by: Heinrich Lee Yu <heinrich@gitlab.com>
2021-11-02 07:49:34 -07:00
Mike Perham
8cc43f72fe merge 2021-11-01 10:46:23 -07:00
Mike Perham
ba2fa2d26c Extract constant 2021-11-01 10:44:26 -07:00
Mike Perham
4d303904e5
Refresh javascripts ()
Refactor Web UI javascripts:

- Remove jQuery
- Remove dropdown.js, unused
- Update app JS to use vanilla JS
2021-11-01 09:55:17 -07:00
Mike Perham
343b090a6f Add context and discussion place for RTT warning 2021-10-31 14:23:07 -07:00
Mike Perham
767217133e Refactor Web UI javascripts
- Remove jQuery
- Remove dropdown.js, unused
- Update app JS to use vanilla JS
2021-10-27 16:21:15 -07:00
Mike Perham
bd3f2009ec Remove multithreaded writes to the same Array when using JRuby, fixes 2021-10-21 11:39:12 -07:00
Ivy Evans
1f05bd6010
Fix Uncaught exception: can't dump IO () 2021-10-12 17:14:55 -07:00
Mike Perham
06d43cb49f standard styling 2021-10-12 13:33:14 -07:00
Mike Perham
90535ab104 Integrate Sidekiq.logger into Rails.logger, closes
Any use of Rails.logger in jobs will now go to the Sidekiq logger.
2021-10-12 13:28:41 -07:00
Mike Perham
3b233c558a Add support for AJ's :wait option 2021-10-05 14:04:04 -07:00
Mike Perham
305c3865d9 standard formatting 2021-10-05 14:04:04 -07:00
Mike Perham
46f4c6bd9e Stringify queue name to handle symbols from YAML cfg, fixes 2021-09-30 12:09:15 -07:00
Mike Perham
2b2390d579
Support ActiveJob’s wait_until ()
* Implement support for `set(wait_until: <interval>)`

* Implement `queue_as`, docs

* Rollback implementing `perform_later`, it's a footgun

* changes
2021-09-28 11:24:17 -07:00