Commit Graph

39 Commits

Author SHA1 Message Date
Sam 057087e0e8 FEATURE: log long running jobs in the defer queue
If a job in the defer queue takes longer than 90 seconds log an error
2018-10-12 17:03:47 +11:00
Neil Lalonde 4ad7ce70ce REFACTOR: extract scheduler to the mini_scheduler gem 2018-07-31 17:12:55 -04:00
Sam 4d984a5a63 extra diagnostics for thread issues 2018-06-20 09:19:16 +10:00
Sam bcfd9cf8b5 attempt to stabilize spec 2018-05-22 16:15:24 +10:00
Sam 2b8d4508e5 PERF: stop running background work between requests
Use a dedicated thread to run Scheduler::Defer

This avoids blocking of a worker during operations that require waiting.

In particular uploads risked blocking a unicorn.

This also add a queue "length" that discourse prometheus consumes.
2017-11-23 15:48:47 +11:00
Sam 5881355006 remove uneeded assertion 2017-10-04 15:59:16 +11:00
Sam 4ee2fcd3d5 correct flaky spec 2017-10-04 10:47:24 +11:00
Sam c7532003f3 add more diagnostics for flaky spec 2017-08-23 10:41:57 -04:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Sam ad8643bfe2 attempt to stablise spec in travis 2017-07-25 16:58:19 -04:00
Guo Xiang Tan be3c9bca0b Remove comment that is no longer relevant. 2017-07-25 08:58:40 +09:00
Sam 04eac9f14a lets attempt to get these specs working! 2017-07-24 18:35:20 -04:00
Sam f67e715ef1 comment out specs that break others
will check in a fixed spec tomorrow
2017-07-24 17:28:24 -04:00
Sam c08a7aee8f clean up skipped tests
tighter connection handling in scheduler
2017-07-24 15:06:24 -04:00
Sam 80bb127cd3 use time zone for extra safety 2017-07-24 13:08:17 -04:00
Sam 7ebb9874a8 freeze time in spec 2017-07-24 13:00:15 -04:00
Guo Xiang Tan d940166a89 Re-enable skipped `Scheduler::ScheduleInfo` test. 2017-07-25 00:03:03 +09:00
Guo Xiang Tan ecb2a0b9c7
Skip tests for now. 2016-06-06 18:18:12 +08:00
Guo Xiang Tan bb92be5784
Clean up Redis after each test. 2016-06-06 17:32:09 +08:00
Sam 3eec0a83b0 clean up stop semantics and bypass test 2016-05-30 13:59:58 +10:00
Sam e11c83341c add more specs 2016-05-30 12:43:01 +10:00
Sam cc088956bc correct some test concurrency bugs 2016-05-30 12:28:05 +10:00
Sam c9dcffe434 FEATURE: store history for scheduled job execution 2016-05-30 11:38:08 +10:00
Andy Waite 3e50313fdc Prepare for separation of RSpec helper files
Since rspec-rails 3, the default installation creates two helper files:
* `spec_helper.rb`
* `rails_helper.rb`

`spec_helper.rb` is intended as a way of running specs that do not
require Rails, whereas `rails_helper.rb` loads Rails (as Discourse's
current `spec_helper.rb` does).

For more information:

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files

In this commit, I've simply replaced all instances of `spec_helper` with
`rails_helper`, and renamed the original `spec_helper.rb`.

This brings the Discourse project closer to the standard usage of RSpec
in a Rails app.

At present, every spec relies on loading Rails, but there are likely
many that don't need to. In a future pull request, I hope to introduce a
separate, minimal `spec_helper.rb` which can be used in tests which
don't rely on Rails.
2015-12-01 20:39:42 +00:00
Sam d6d9a7fa09 FEATURE: per host regular jobs
These are jobs that will run on every host that is running discourse.

If you have multiple hosts running the same site you get independent
schedules
2015-06-26 13:37:05 +10:00
Sam cdef67667a PERF: allow background jobs to flush between requests in same thread 2015-02-17 09:58:43 +11:00
Luciano Sousa 0fd98b56d8 few components with rspec3 syntax 2015-01-09 13:34:37 -03:00
Régis Hanol de76b512c1 fix most deprecations in the specs (still some left) 2014-09-25 17:44:48 +02:00
Sam 798b8444cf BUGFIX: work correctly if process forks 2014-03-17 15:22:11 +11:00
Sam 2c8ae22b87 FEATURE: add a simple queue Scheduler::Defer.later {}
For quick jobs that do not need to be sent to sidekiq,
runs inline in a single thread but does not block
2014-03-17 12:16:19 +11:00
Neil Lalonde 98284d771f Mark failing spec as pending for Robin to investigate 2014-03-14 18:13:45 -04:00
Robin Ward e22f1ae186 Support for a daily job at a certain hour. Convert backup job to run at
3am instead of randomly during the day.
2014-03-14 13:02:45 -04:00
Sam 5c3f2feed4 BUGFIX: recovery code in case an unknown job is scheduled 2014-03-04 07:37:12 +11:00
Sam 71a38542a4 FEATURE: automatic orphan recovery
BUGFIX: improve scheduler robustness, in case redis is disconnected during operation

If sidekiq is terminated while task is running, it will be picked up and ran again
New owner on tasks to help debugging
better #stop semantics for tests
2014-02-12 13:33:24 +11:00
Sam fd34932068 use discourse redis, not redis 2014-02-11 16:11:51 +11:00
Sam 90ae4c6224 Try to fix random failing spec 2014-02-09 07:55:11 +11:00
Sam 585fae0541 another try fixing this test 2014-02-07 14:38:00 +11:00
Sam e1f293ad66 FEATURE: new scheduler
Removed sidetiq, introduced new scheduler

- add basic UI
- add schedule discover
- add scheduling in initializer
2014-02-06 10:26:16 +11:00
Sam ed45a1dce3 FEATURE: new scheduler so we can deprecate sidetiq
This is a work in progress, should have it finished tomorrow.
2014-01-30 16:21:38 +11:00