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

33 commits

Author SHA1 Message Date
Mike Perham
4a0470de42 Remove Rails <5 code/patches/hacks, bump! 2018-12-28 10:16:50 -08:00
Andrew Babichev
ea9b34a953 Add CLI Run Test - Write Pid, System Boot, Print Banner (#4039)
* Add appraisal

* Test CLI run (write pid, system boot, print banner)

* Cleanup test helper

* Set REDIS_URL to use non-default host in test env

* Move mintiest-focus to test bundle group
2018-12-07 08:59:42 -08:00
Simon Coffey
abca42db3c Revert "Use active record cache when available"
This reverts commit a27d692656.

The reason for reverting is that this middleware has no effect. In Rails
5.0+, Sidekiq runs its jobs using the Rails reloader/executor API[1].

In Rails 5.0+, however, the ActiveRecord query cache registers its own
hooks with the executor[2], and these hooks automatically enable the
query cache for the duration of any work the executor performs[3].

As a result, the query cache is already on by default for any Sidekiq
jobs run in Rails 5.0+, so it's not necessary to separately enable it in
a middleware.

[1] eca6acc0ce/lib/sidekiq/rails.rb (L33-L37)
[2] f8c00c1300/activerecord/lib/active_record/railtie.rb (L159-L163)
[3] f8c00c1300/activerecord/lib/active_record/query_cache.rb (L26-L41)
2018-02-15 10:02:52 -08:00
Gabriel Sobrinho
a27d692656 Use active record cache when available
This will prevent duplicated queries on database at the same job.
2018-01-12 09:00:36 -08:00
Matthew Savage
4dc90f0214 Added warning to STDERR if we detect Rails 3.x (< 4) about Sidekiq not supporting this version any more 2017-10-26 13:18:59 -07:00
Mike Perham
f9781e1bac Move constantize to Sidekiq::Util, #3474
I don’t believe we need the Psych patch anymore because Sidekiq 5 guarantees that jobs are executed within Rails::Executor so classes should load as normal.  This was not the case back in early 4.2.x, 4.2.0, 4.2.1, etc.
2017-05-15 14:57:03 -07:00
Mike Perham
701e06224c Rework job processing in light of Rails 5's Reloader (#3235)
* Rework job processing in light of Rails 5's Reloader, see #3221

* Ignore built gems

* Documentation, testing

* Add fallback for 'retry' value server-side, fixes #3234

* Fix job hash reporting in stats

* cleanup

* Add job for AJ testing

* Push jobs with invalid JSON immediately to Dead set, fixes #3296

* Break retry logic into global and local parts, fixes #3306

* fix heisentest
2017-01-17 14:58:08 -08:00
Mike Perham
cc59d07e48 Disable delay extensions by default, fixes #3174 (#3299)
* Disable delay extensions by default, fixes #3174

* Size check for YAML payload

* so racy

* Allow larger, explicit size in message

* Polish
2017-01-04 10:30:42 -08:00
Mike Perham
b427f34331 Only configure reloader/executor in server mode, not necessary in client mode, fixes #3275 2016-12-12 09:39:12 -08:00
Sergey Alexandrovich
5a4e4bb8f4 Monkeypatch Psych to enable Rails autoloading (#3227) 2016-11-22 09:21:16 -08:00
Eugene Kenny
f49b4f11db Use Rails executor if code reloading is disabled (#3221)
We have to release the current thread's Active Record connection after
performing each job, in case another thread is waiting to use it.

On Rails 4 and earlier, this is handled with middleware. On Rails 5 in
development mode, the reloader does it by delegating to the executor.
However on Rails 5 in production mode, we're not adding the middleware
or enabling the reloader, so connections will never be released.

We can call the executor directly to have it release the connection for
us in this case. By calling it inside the middleware stack, the job will
be retried if the executor raises, avoiding the problem with lost jobs
that led to the reloader being disabled in production.
2016-11-12 09:17:36 -05:00
Mike Perham
4b3d5edd18 Don't use the Reloader API at all when caching classes, #3154 2016-10-17 10:54:46 -07:00
Samuel Cochran
659dea9601 Resolve Rails Reloader and ActiveRecord middleware incompatibility (#3166)
* Prevent AR middleware and reloader clash

The ActiveRecord middleware releases any current ActiveRecord
connections before the reloader has a chance to clear their query
caches.

We can just remove this middleware because the reloader takes care of
clearing active connections, too.

* Make sure folks haven't added the middleware manually

* Fix the conditional

* Mention that the reloader also clears connections

* Move it all back into a single method

* Typos

* Pull all rails setup into railtie

* Set the middleware even earlier

Also clarify exactly when these hooks are run.

* Only check ActiveRecord reloader/middleware sanity at boot
2016-09-30 15:27:54 -07:00
Mike Perham
871626c9b3 Refactor Rails 5 integration, per @matthewd 2016-07-01 09:31:08 -07:00
Mike Perham
fbb074fb5f Use cache_classes, rather than environment, to enable reloading 2016-06-15 16:49:40 -07:00
Mike Perham
a67c9b1d90 merge master 2016-06-15 16:48:40 -07:00
Mike Perham
e4d09527c4 polish 2016-04-28 10:38:46 -07:00
Mike Perham
df002c1576 Update reload API for 5.0.beta4 2016-04-28 10:02:03 -07:00
Mike Perham
51347c5d97 Live code reloading, so hot right now! 2016-02-01 15:59:20 -08:00
Mike Perham
2c9f7662fc Freeze all string literals in source, fixes #2741
Tests pass and smoke test works perfectly.
2015-12-31 15:33:35 -08:00
Jason Nochlin
8cf0bf447c Never include modules if .remove_delay was called 2014-06-28 18:20:42 -04:00
Mike Perham
7395f71373 rename method 2014-05-20 20:42:25 -07:00
Mike Perham
aec53975e3 Merge pull request #1674 from devaroop/master
Option to remove the generic aliases which MAY clash
2014-05-20 20:21:11 -07:00
Mike Perham
d8d3df9f2f Dont need to manually add app/workers to autoload_paths 2014-04-28 21:11:28 -07:00
Devaroop
e5687d7184 Removes the generic aliases which MAY clash with names of already declared by other applications 2014-04-24 19:41:05 +05:30
Rafael Mendonça França
499882d4d4 Use ActiveSupport.on_load hooks to extend rails components
Checking if the constant is define and including the extensions directly
in the base class will for the class to be loaded. This may cause these
components to be loaded before the time and be missconfigured if the
sidekiq railtie is loaded before the components railtie.

It is unlikely to happen but is better be safe.
2014-03-28 21:36:38 -03:00
Sean Doyle
e12bf878fa Replaced class and instance level send
Replaced with `__send__` from std lib

* `send` can now be overridden to be more semantically meaningful
  * `message.send(user_id)` as opposed to `message.send_message(user_id)`
* `__send__` makes it clear that the reflective version is intended
2014-02-14 09:43:34 -05:00
Mike Perham
b0fa69a915 Remove optionality of Rails hooks, #401 2012-09-20 20:04:25 -07:00
Mike Perham
e55979407a Add extension to delay any arbitrary class method to Sidekiq. 2012-08-16 16:43:01 -07:00
Jon Hinson
f15ceb93c5 Renaming hook_rails option to enable_rails_extensions 2012-03-26 18:05:33 -05:00
Jon Hinson
cd423f9cdc Add hook_rails configuration option to make the Rails extensions optional 2012-03-26 15:37:38 -05:00
Mike Perham
65bf77217b Fix require ordering causing extensions to not load properly, GH-77. 2012-03-10 12:30:15 -08:00
Mike Perham
2771a0ad96 Rename workers to processors. New Railtie support.
Workers are the user's classes, the threads are now called processors.  Add secret sauce to make Rails config much easier.  Use a railtie to auto-add app/workers to the autoload path.
2012-01-25 13:32:51 -08:00