good_job 2.14.0 → 2.14.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -0
- data/README.md +52 -16
- data/engine/app/assets/good_job/modules/application.js +4 -2
- data/engine/app/assets/good_job/modules/live_poll.js +81 -0
- data/engine/app/controllers/good_job/cron_entries_controller.rb +2 -2
- data/engine/app/controllers/good_job/jobs_controller.rb +2 -2
- data/engine/app/filters/good_job/base_filter.rb +4 -2
- data/engine/app/filters/good_job/jobs_filter.rb +2 -1
- data/engine/app/views/good_job/cron_entries/show.html.erb +1 -1
- data/engine/app/views/good_job/executions/_table.erb +1 -1
- data/engine/app/views/good_job/jobs/_table.erb +5 -6
- data/engine/app/views/good_job/jobs/index.html.erb +14 -12
- data/engine/app/views/good_job/processes/index.html.erb +1 -1
- data/engine/app/views/good_job/shared/_chart.erb +1 -1
- data/engine/app/views/good_job/shared/_filter.erb +1 -1
- data/engine/app/views/good_job/shared/_footer.erb +1 -1
- data/engine/app/views/good_job/shared/_navbar.erb +5 -5
- data/engine/config/routes.rb +1 -1
- data/lib/good_job/configuration.rb +1 -1
- data/lib/good_job/probe_server.rb +1 -1
- data/lib/good_job/version.rb +1 -1
- metadata +4 -4
- data/engine/app/assets/good_job/modules/poller.js +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f53ed707cdafa1bedf790afd1465aefd1453bb7f7a1d358a577ee4769743d94a
|
4
|
+
data.tar.gz: 77274ebd06c82c4caec8369f6cf9eaeafd90c70960ed2722314cdd773c08a02b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83283b1fbd4983b9a7814cf5f67dad4c78df64d046db45c95f1f6aa8f118f1a1cb0e522b32bb8e5f38e8e0a52ec2408da209abc03a041fd9f665015d2c8b854f
|
7
|
+
data.tar.gz: 98091d7a44f02ddfad810af0195dab7c8c581475b8d049b570d28c86921363c6fafa8ab6fcc4221dc5efa662fae3918e5f98579f45f847ee82ba3d97e44a5b8c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,51 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v2.14.3](https://github.com/bensheldon/good_job/tree/v2.14.3) (2022-05-13)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.14.2...v2.14.3)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Bind probe server to all interfaces [\#598](https://github.com/bensheldon/good_job/pull/598) ([Timmitry](https://github.com/Timmitry))
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- NoMethodError: undefined method `current\_tags' for nil:NilClass [\#596](https://github.com/bensheldon/good_job/issues/596)
|
14
|
+
- When running rspec, I get: current transaction is aborted, commands ignored until end of transaction block [\#595](https://github.com/bensheldon/good_job/issues/595)
|
15
|
+
- CLI healtheck only listening on localhost, not reachable for Kubernetes [\#592](https://github.com/bensheldon/good_job/issues/592)
|
16
|
+
|
17
|
+
**Merged pull requests:**
|
18
|
+
|
19
|
+
- Improve development instructions and tooling \(rename bin/rails, add bin/appraisal\) [\#590](https://github.com/bensheldon/good_job/pull/590) ([bensheldon](https://github.com/bensheldon))
|
20
|
+
- Replace test Instrumentation mocking with temporary subscriptions [\#589](https://github.com/bensheldon/good_job/pull/589) ([bensheldon](https://github.com/bensheldon))
|
21
|
+
- Update to development to Ruby 3.0.4, include `matrix` gem in development Gemfile [\#588](https://github.com/bensheldon/good_job/pull/588) ([bensheldon](https://github.com/bensheldon))
|
22
|
+
|
23
|
+
## [v2.14.2](https://github.com/bensheldon/good_job/tree/v2.14.2) (2022-05-01)
|
24
|
+
|
25
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.14.1...v2.14.2)
|
26
|
+
|
27
|
+
**Fixed bugs:**
|
28
|
+
|
29
|
+
- Reintroduce fixed "Apply to all" mass action [\#586](https://github.com/bensheldon/good_job/pull/586) ([bensheldon](https://github.com/bensheldon))
|
30
|
+
|
31
|
+
**Closed issues:**
|
32
|
+
|
33
|
+
- how to get the number of tasks in the queue and the size of the queue? [\#564](https://github.com/bensheldon/good_job/issues/564)
|
34
|
+
- GoodJob tells me to upgrade but migrations fail [\#544](https://github.com/bensheldon/good_job/issues/544)
|
35
|
+
|
36
|
+
**Merged pull requests:**
|
37
|
+
|
38
|
+
- Update development dependencies [\#584](https://github.com/bensheldon/good_job/pull/584) ([bensheldon](https://github.com/bensheldon))
|
39
|
+
- Refactor Dashboard Live Poll javascript [\#582](https://github.com/bensheldon/good_job/pull/582) ([bensheldon](https://github.com/bensheldon))
|
40
|
+
|
41
|
+
## [v2.14.1](https://github.com/bensheldon/good_job/tree/v2.14.1) (2022-04-26)
|
42
|
+
|
43
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.14.0...v2.14.1)
|
44
|
+
|
45
|
+
**Fixed bugs:**
|
46
|
+
|
47
|
+
- Temporarily disable Mass Action "Apply to all" because the action is badly scoped [\#583](https://github.com/bensheldon/good_job/pull/583) ([bensheldon](https://github.com/bensheldon))
|
48
|
+
|
3
49
|
## [v2.14.0](https://github.com/bensheldon/good_job/tree/v2.14.0) (2022-04-26)
|
4
50
|
|
5
51
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.13.2...v2.14.0)
|
data/README.md
CHANGED
@@ -60,6 +60,9 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
|
|
60
60
|
- [CLI HTTP health check probes](#cli-http-health-check-probes)
|
61
61
|
- [Contribute](#contribute)
|
62
62
|
- [Gem development](#gem-development)
|
63
|
+
- [Development setup](#development-setup)
|
64
|
+
- [Rails development harness](#rails-development-harness)
|
65
|
+
- [Running tests](#running-tests)
|
63
66
|
- [Release](#release)
|
64
67
|
- [License](#license)
|
65
68
|
|
@@ -941,49 +944,82 @@ spec:
|
|
941
944
|
|
942
945
|
## Contribute
|
943
946
|
|
944
|
-
|
947
|
+
<!-- Please keep this section in sync with CONTRIBUTING.md -->
|
948
|
+
|
949
|
+
All contributions, from feedback to code and beyond, are welcomed and appreciated 🙏
|
945
950
|
|
946
951
|
- Review the [Prioritized Project Backlog](https://github.com/bensheldon/good_job/projects/1).
|
947
952
|
- Open a new Issue or contribute to an [existing Issue](https://github.com/bensheldon/good_job/issues). Questions or suggestions are fantastic.
|
948
|
-
- Participate according to our [Code of Conduct](
|
953
|
+
- Participate according to our [Code of Conduct](/CODE_OF_CONDUCT.md).
|
954
|
+
- Financially support the project via [Sponsorship](https://github.com/sponsors/bensheldon).
|
955
|
+
|
956
|
+
For gem development and debugging information, please review the [README's Gem Development section](/README.md#gem-development).
|
949
957
|
|
950
958
|
### Gem development
|
951
959
|
|
952
|
-
|
960
|
+
#### Development setup
|
953
961
|
|
954
962
|
```bash
|
955
963
|
# Clone the repository locally
|
956
|
-
|
964
|
+
git clone git@github.com:bensheldon/good_job.git
|
957
965
|
|
958
966
|
# Set up the local environment
|
959
|
-
|
960
|
-
|
961
|
-
# Run the tests
|
962
|
-
$ bin/rspec
|
967
|
+
bin/setup
|
963
968
|
```
|
964
969
|
|
965
|
-
|
970
|
+
#### Rails development harness
|
971
|
+
|
972
|
+
A Rails application exists within `spec/test_app` that is used for development, test, and GoodJob Demo environments.
|
966
973
|
|
967
974
|
```bash
|
968
|
-
#
|
969
|
-
|
975
|
+
# Run a local development webserver
|
976
|
+
bin/rails s
|
977
|
+
|
978
|
+
# Disable job execution and cron for cleaner console output
|
979
|
+
GOOD_JOB_ENABLE_CRON=0 GOOD_JOB_EXECUTION_MODE=external bin/rails s
|
970
980
|
|
971
|
-
#
|
972
|
-
|
981
|
+
# Open the Rails console
|
982
|
+
bin/rails c
|
973
983
|
```
|
974
984
|
|
975
985
|
For developing locally within another Ruby on Rails project:
|
976
986
|
|
977
987
|
```bash
|
978
|
-
# Within Ruby on Rails directory
|
979
|
-
|
988
|
+
# Within Ruby on Rails project directory
|
989
|
+
# Ensure that the Gemfile is set to git with a branch e.g.
|
990
|
+
# gem "good_job", git: "https://github.com/bensheldon/good_job.git", branch: "main"
|
991
|
+
# Then, override the Bundle config to point to the local filesystem's good_job repository
|
992
|
+
bundle config local.good_job /path/to/local/good_job/repository
|
980
993
|
|
981
994
|
# Confirm that the local copy is used
|
982
|
-
|
995
|
+
bundle install
|
983
996
|
|
984
997
|
# => Using good_job 0.1.0 from https://github.com/bensheldon/good_job.git (at /Users/You/Projects/good_job@dc57fb0)
|
985
998
|
```
|
986
999
|
|
1000
|
+
#### Running tests
|
1001
|
+
|
1002
|
+
Tests can be run against the primary development environment:
|
1003
|
+
|
1004
|
+
```bash
|
1005
|
+
bin/rspec
|
1006
|
+
```
|
1007
|
+
|
1008
|
+
Environment variables that may help with debugging:
|
1009
|
+
|
1010
|
+
- `LOUD=1`: display all stdout/stderr output from all sources. This is helpful because GoodJob wraps some tests with `quiet { }` for cleaner test output, but it can hinder debugging.
|
1011
|
+
- `SHOW_BROWSER=1`: Run system tests headfully with Chrome/Chromedriver. Use `binding.irb` in the system tests to pause.
|
1012
|
+
|
1013
|
+
Appraisal can be used to run a test matrix of multiple versions of Rails:
|
1014
|
+
|
1015
|
+
```bash
|
1016
|
+
# Install Appraisal matrix of gemfiles
|
1017
|
+
bin/appraisal
|
1018
|
+
|
1019
|
+
# Run tests against matrix
|
1020
|
+
bin/appraisal bin/rspec
|
1021
|
+
```
|
1022
|
+
|
987
1023
|
### Release
|
988
1024
|
|
989
1025
|
Package maintainers can release this gem by running:
|
@@ -4,11 +4,13 @@ import renderCharts from "charts";
|
|
4
4
|
import checkboxToggle from "checkbox_toggle";
|
5
5
|
import documentReady from "document_ready";
|
6
6
|
import showToasts from "toasts";
|
7
|
-
import
|
7
|
+
import LivePoll from "live_poll";
|
8
8
|
|
9
9
|
documentReady(function() {
|
10
10
|
renderCharts();
|
11
11
|
showToasts();
|
12
12
|
checkboxToggle();
|
13
|
-
|
13
|
+
|
14
|
+
const livePoll = new LivePoll
|
15
|
+
livePoll.start();
|
14
16
|
});
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/*jshint esversion: 6, strict: false */
|
2
|
+
import renderCharts from "charts";
|
3
|
+
|
4
|
+
const MINIMUM_POLL_INTERVAL = 1;
|
5
|
+
const STORAGE_KEY = "live_poll";
|
6
|
+
|
7
|
+
function getStorage(key) {
|
8
|
+
const value = localStorage.getItem('good_job-' + key);
|
9
|
+
|
10
|
+
if (value === 'true') {
|
11
|
+
return true;
|
12
|
+
} else if (value === 'false') {
|
13
|
+
return false;
|
14
|
+
} else {
|
15
|
+
return value;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
function setStorage(key, value) {
|
20
|
+
localStorage.setItem('good_job-' + key, value);
|
21
|
+
}
|
22
|
+
|
23
|
+
function removeStorage(key) {
|
24
|
+
localStorage.removeItem('good_job-' + key);
|
25
|
+
}
|
26
|
+
|
27
|
+
export default class LivePoll {
|
28
|
+
start() {
|
29
|
+
const checkbox = document.querySelector('input[name="live_poll"]');
|
30
|
+
|
31
|
+
if (!checkbox.checked && getStorage(STORAGE_KEY)) {
|
32
|
+
checkbox.checked = true;
|
33
|
+
checkbox.value = getStorage(STORAGE_KEY)
|
34
|
+
}
|
35
|
+
|
36
|
+
checkbox.addEventListener('change', () => {
|
37
|
+
this.togglePolling();
|
38
|
+
});
|
39
|
+
|
40
|
+
this.togglePolling();
|
41
|
+
}
|
42
|
+
|
43
|
+
togglePolling = () => {
|
44
|
+
const checkbox = document.querySelector('input[name="live_poll"]');
|
45
|
+
const enabled = checkbox.checked;
|
46
|
+
const pollIntervalMilliseconds = Math.max(parseInt(checkbox.value), MINIMUM_POLL_INTERVAL) * 1000;
|
47
|
+
|
48
|
+
if (this.interval) {
|
49
|
+
clearInterval(this.interval);
|
50
|
+
this.interval = null;
|
51
|
+
}
|
52
|
+
|
53
|
+
if (enabled) {
|
54
|
+
setStorage(STORAGE_KEY, checkbox.value);
|
55
|
+
this.interval = setInterval(LivePoll.refreshPage, pollIntervalMilliseconds);
|
56
|
+
} else {
|
57
|
+
removeStorage(STORAGE_KEY);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
static refreshPage() {
|
62
|
+
fetch(window.location.href)
|
63
|
+
.then(resp => resp.text())
|
64
|
+
.then(LivePoll.updatePageContent);
|
65
|
+
}
|
66
|
+
|
67
|
+
static updatePageContent(newContent) {
|
68
|
+
const domParser = new DOMParser();
|
69
|
+
const newDom = domParser.parseFromString(newContent, "text/html");
|
70
|
+
|
71
|
+
const newElements = newDom.querySelectorAll('[data-live-poll-region]');
|
72
|
+
newElements.forEach((newElement) => {
|
73
|
+
const regionName = newElement.getAttribute('data-live-poll-region');
|
74
|
+
const originalElement = document.querySelector(`[data-live-poll-region="${regionName}"]`);
|
75
|
+
|
76
|
+
originalElement.replaceWith(newElement);
|
77
|
+
});
|
78
|
+
|
79
|
+
renderCharts(false);
|
80
|
+
}
|
81
|
+
}
|
@@ -6,12 +6,12 @@ module GoodJob
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def show
|
9
|
-
@cron_entry = CronEntry.find(params[:
|
9
|
+
@cron_entry = CronEntry.find(params[:cron_key])
|
10
10
|
@jobs_filter = JobsFilter.new(params, @cron_entry.jobs)
|
11
11
|
end
|
12
12
|
|
13
13
|
def enqueue
|
14
|
-
@cron_entry = CronEntry.find(params[:
|
14
|
+
@cron_entry = CronEntry.find(params[:cron_key])
|
15
15
|
@cron_entry.enqueue(Time.current)
|
16
16
|
redirect_back(fallback_location: cron_entries_path, notice: "Cron entry has been enqueued.")
|
17
17
|
end
|
@@ -22,7 +22,7 @@ module GoodJob
|
|
22
22
|
raise ActionController::BadRequest, "#{mass_action} is not a valid mass action" unless mass_action.in?(ACTIONS.keys)
|
23
23
|
|
24
24
|
jobs = if params[:all_job_ids]
|
25
|
-
|
25
|
+
JobsFilter.new(params).filtered_query
|
26
26
|
else
|
27
27
|
job_ids = params.fetch(:job_ids, [])
|
28
28
|
ActiveJobJob.where(active_job_id: job_ids)
|
@@ -49,7 +49,7 @@ module GoodJob
|
|
49
49
|
"No jobs were #{ACTIONS[mass_action]}"
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
redirect_back(fallback_location: jobs_path, notice: notice)
|
53
53
|
end
|
54
54
|
|
55
55
|
def show
|
@@ -47,6 +47,7 @@ module GoodJob
|
|
47
47
|
queue_name: params[:queue_name],
|
48
48
|
query: params[:query],
|
49
49
|
state: params[:state],
|
50
|
+
cron_key: params[:cron_key],
|
50
51
|
}.merge(override).delete_if { |_, v| v.blank? }
|
51
52
|
end
|
52
53
|
|
@@ -54,8 +55,9 @@ module GoodJob
|
|
54
55
|
raise NotImplementedError
|
55
56
|
end
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
def filtered_count
|
59
|
+
filtered_query.count
|
60
|
+
end
|
59
61
|
|
60
62
|
private
|
61
63
|
|
@@ -18,6 +18,7 @@ module GoodJob
|
|
18
18
|
query = query.job_class(params[:job_class]) if params[:job_class].present?
|
19
19
|
query = query.where(queue_name: params[:queue_name]) if params[:queue_name].present?
|
20
20
|
query = query.search_text(params[:query]) if params[:query].present?
|
21
|
+
query = query.where(cron_key: params[:cron_key]) if params[:cron_key].present?
|
21
22
|
|
22
23
|
if params[:state]
|
23
24
|
case params[:state]
|
@@ -39,7 +40,7 @@ module GoodJob
|
|
39
40
|
query
|
40
41
|
end
|
41
42
|
|
42
|
-
def
|
43
|
+
def filtered_count
|
43
44
|
filtered_query.unscope(:select).count
|
44
45
|
end
|
45
46
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<div class="my-3"
|
1
|
+
<div class="my-3">
|
2
2
|
<div class="table-responsive">
|
3
|
-
<%= form_with(url: mass_update_jobs_path, method: :put, local: true, data: { "checkbox-toggle": "job_ids" }) do |form| %>
|
4
|
-
<table class="table table-hover table-sm mb-0">
|
3
|
+
<%= form_with(url: mass_update_jobs_path(filter.to_params), method: :put, local: true, data: { "checkbox-toggle": "job_ids" }) do |form| %>
|
4
|
+
<table class="table table-hover table-sm mb-0 table-jobs">
|
5
5
|
<thead>
|
6
6
|
<tr>
|
7
7
|
<th><%= check_box_tag('toggle_job_ids', "1", false, data: { "checkbox-toggle-all": "job_ids" }) %></th>
|
@@ -35,14 +35,13 @@
|
|
35
35
|
<%= render_icon "arrow_clockwise" %> All
|
36
36
|
<% end %>
|
37
37
|
</div>
|
38
|
+
</th>
|
38
39
|
</tr>
|
39
40
|
<tr class="d-none" data-checkbox-toggle-show="job_ids">
|
40
41
|
<td class="text-center table-warning" colspan="10">
|
41
|
-
<% all_jobs_count = local_assigns[:all_jobs_count] %>
|
42
42
|
<label>
|
43
43
|
<%= check_box_tag "all_job_ids", 1, false, disabled: true, data: { "checkbox-toggle-show": "job_ids"} %>
|
44
|
-
Apply to all <%=
|
45
|
-
<em>This could be a lot.</em>
|
44
|
+
Apply to all <%= filter.filtered_count %> <%= "job".pluralize(filter.filtered_count) %>.
|
46
45
|
</label>
|
47
46
|
</td>
|
48
47
|
</tr>
|
@@ -1,15 +1,17 @@
|
|
1
1
|
<%= render 'good_job/shared/filter', title: "Jobs", filter: @filter %>
|
2
2
|
<%= render 'good_job/shared/chart', chart_data: GoodJob::ScheduledByQueueChart.new(@filter).data %>
|
3
|
-
<%= render 'good_job/jobs/table', jobs: @filter.records, all_jobs_count: @filter.filtered_query_count %>
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
<div data-live-poll-region="jobs-table">
|
5
|
+
<%= render 'good_job/jobs/table', jobs: @filter.records, filter: @filter %>
|
6
|
+
<% if @filter.records.present? %>
|
7
|
+
<nav aria-label="Job pagination" class="mt-3">
|
8
|
+
<ul class="pagination">
|
9
|
+
<li class="page-item">
|
10
|
+
<%= link_to(@filter.to_params(after_scheduled_at: (@filter.last.scheduled_at || @filter.last.created_at), after_id: @filter.last.id), class: "page-link") do %>
|
11
|
+
Older jobs <span aria-hidden="true">»</span>
|
12
|
+
<% end %>
|
13
|
+
</li>
|
14
|
+
</ul>
|
15
|
+
</nav>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<footer class="footer mt-auto py-3 bg-light border-top text-muted small" id="footer" data-
|
1
|
+
<footer class="footer mt-auto py-3 bg-light border-top text-muted small" id="footer" data-live-poll-region="footer">
|
2
2
|
<div class="container-fluid">
|
3
3
|
<div class="row">
|
4
4
|
<div class="col-6">
|
@@ -14,14 +14,14 @@
|
|
14
14
|
<%= link_to t(".cron_schedules"), cron_entries_path, class: ["nav-link", ("active" if controller_name == 'cron_entries')] %>
|
15
15
|
</li>
|
16
16
|
<li class="nav-item">
|
17
|
-
<%= link_to t(".processes"), processes_path, class: ["nav-link", ("active" if
|
17
|
+
<%= link_to t(".processes"), processes_path, class: ["nav-link", ("active" if controller_name == 'processes')] %>
|
18
18
|
</li>
|
19
19
|
</ul>
|
20
20
|
<div class="nav-item pe-2">
|
21
|
-
<
|
22
|
-
|
23
|
-
|
24
|
-
</
|
21
|
+
<label>
|
22
|
+
<%= check_box_tag "live_poll", params.fetch("poll", 30), params[:poll].present? %>
|
23
|
+
<%= t(".live_poll") %>
|
24
|
+
</label>
|
25
25
|
</div>
|
26
26
|
<ul class="navbar-nav">
|
27
27
|
<li class="nav-item dropdown">
|
data/engine/config/routes.rb
CHANGED
@@ -159,7 +159,7 @@ module GoodJob
|
|
159
159
|
alias enable_cron? enable_cron
|
160
160
|
|
161
161
|
def cron
|
162
|
-
env_cron = JSON.parse(ENV
|
162
|
+
env_cron = JSON.parse(ENV.fetch('GOOD_JOB_CRON'), symbolize_names: true) if ENV['GOOD_JOB_CRON'].present?
|
163
163
|
|
164
164
|
options[:cron] ||
|
165
165
|
rails_config[:cron] ||
|
@@ -17,7 +17,7 @@ module GoodJob
|
|
17
17
|
def start
|
18
18
|
@handler = Rack::Handler.get(RACK_SERVER)
|
19
19
|
@future = Concurrent::Future.new(args: [@handler, @port, GoodJob.logger]) do |thr_handler, thr_port, thr_logger|
|
20
|
-
thr_handler.run(self, Port: thr_port, Logger: thr_logger, AccessLog: [])
|
20
|
+
thr_handler.run(self, Port: thr_port, Host: '0.0.0.0', Logger: thr_logger, AccessLog: [])
|
21
21
|
end
|
22
22
|
@future.add_observer(self.class, :task_observer)
|
23
23
|
@future.execute
|
data/lib/good_job/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: good_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
4
|
+
version: 2.14.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sheldon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -364,7 +364,7 @@ files:
|
|
364
364
|
- engine/app/assets/good_job/modules/charts.js
|
365
365
|
- engine/app/assets/good_job/modules/checkbox_toggle.js
|
366
366
|
- engine/app/assets/good_job/modules/document_ready.js
|
367
|
-
- engine/app/assets/good_job/modules/
|
367
|
+
- engine/app/assets/good_job/modules/live_poll.js
|
368
368
|
- engine/app/assets/good_job/modules/toasts.js
|
369
369
|
- engine/app/assets/good_job/scripts.js
|
370
370
|
- engine/app/assets/good_job/style.css
|
@@ -483,7 +483,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
483
483
|
- !ruby/object:Gem::Version
|
484
484
|
version: '0'
|
485
485
|
requirements: []
|
486
|
-
rubygems_version: 3.
|
486
|
+
rubygems_version: 3.2.33
|
487
487
|
signing_key:
|
488
488
|
specification_version: 4
|
489
489
|
summary: A multithreaded, Postgres-based ActiveJob backend for Ruby on Rails
|
@@ -1,93 +0,0 @@
|
|
1
|
-
/*jshint esversion: 6, strict: false */
|
2
|
-
import renderCharts from "charts";
|
3
|
-
|
4
|
-
// NOTE: this file is a bit disorganized. Please do not use it as a template for how to organize a JS module.
|
5
|
-
|
6
|
-
const DEFAULT_POLL_INTERVAL_SECONDS = 30;
|
7
|
-
const MINIMUM_POLL_INTERVAL = 1000;
|
8
|
-
|
9
|
-
function getStorage(key) {
|
10
|
-
const value = localStorage.getItem('good_job-' + key);
|
11
|
-
|
12
|
-
if (value === 'true') {
|
13
|
-
return true;
|
14
|
-
} else if (value === 'false') {
|
15
|
-
return false;
|
16
|
-
} else {
|
17
|
-
return value;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
function setStorage(key, value) {
|
22
|
-
localStorage.setItem('good_job-' + key, value);
|
23
|
-
}
|
24
|
-
|
25
|
-
function updatePageContent(newContent) {
|
26
|
-
const domParser = new DOMParser();
|
27
|
-
const parsedDOM = domParser.parseFromString(newContent, "text/html");
|
28
|
-
|
29
|
-
const newElements = parsedDOM.querySelectorAll('[data-gj-poll-replace]');
|
30
|
-
|
31
|
-
for (let i = 0; i < newElements.length; i++) {
|
32
|
-
const newEl = newElements[i];
|
33
|
-
const oldEl = document.getElementById(newEl.id);
|
34
|
-
|
35
|
-
if (oldEl) {
|
36
|
-
oldEl.replaceWith(newEl);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
renderCharts(false);
|
41
|
-
}
|
42
|
-
|
43
|
-
function refreshPage() {
|
44
|
-
fetch(window.location.href)
|
45
|
-
.then(resp => resp.text())
|
46
|
-
.then(updatePageContent);
|
47
|
-
}
|
48
|
-
|
49
|
-
const Poller = {
|
50
|
-
start: () => {
|
51
|
-
Poller.updateSettings();
|
52
|
-
Poller.pollUpdates();
|
53
|
-
|
54
|
-
const checkbox = document.querySelector('input[name="toggle-poll"]');
|
55
|
-
checkbox.addEventListener('change', Poller.togglePoll)
|
56
|
-
},
|
57
|
-
|
58
|
-
togglePoll: (event) => {
|
59
|
-
Poller.pollEnabled = event.currentTarget.checked;
|
60
|
-
setStorage('pollEnabled', Poller.pollEnabled);
|
61
|
-
},
|
62
|
-
|
63
|
-
updateSettings: () => {
|
64
|
-
const queryString = window.location.search;
|
65
|
-
const urlParams = new URLSearchParams(queryString);
|
66
|
-
|
67
|
-
if (urlParams.has('poll')) {
|
68
|
-
const parsedInterval = (parseInt(urlParams.get('poll')) || DEFAULT_POLL_INTERVAL_SECONDS) * 1000;
|
69
|
-
Poller.pollInterval = Math.max(parsedInterval, MINIMUM_POLL_INTERVAL);
|
70
|
-
setStorage('pollInterval', Poller.pollInterval);
|
71
|
-
|
72
|
-
Poller.pollEnabled = true;
|
73
|
-
} else {
|
74
|
-
Poller.pollInterval = getStorage('pollInterval') || (DEFAULT_POLL_INTERVAL_SECONDS * 1000);
|
75
|
-
Poller.pollEnabled = getStorage('pollEnabled') || false;
|
76
|
-
}
|
77
|
-
|
78
|
-
document.getElementById('toggle-poll').checked = Poller.pollEnabled;
|
79
|
-
},
|
80
|
-
|
81
|
-
pollUpdates: () => {
|
82
|
-
setTimeout(() => {
|
83
|
-
if (Poller.pollEnabled === true) {
|
84
|
-
refreshPage();
|
85
|
-
Poller.pollUpdates();
|
86
|
-
} else {
|
87
|
-
Poller.pollUpdates();
|
88
|
-
}
|
89
|
-
}, Poller.pollInterval);
|
90
|
-
},
|
91
|
-
};
|
92
|
-
|
93
|
-
export { Poller as default };
|