changed
CHANGELOG.md
|
@@ -6,6 6,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
8
|
|
9
|
## [0.16.2] - 2022-04-15
|
10
|
|
11
|
### Added
|
12
|
- API to send signal to worker nodes by @ananthakumaran
|
13
|
### Changed
|
14
|
|
15
|
### Fixed
|
16
|
- Fixed typos #464 by @kianmeng
|
17
|
|
9
18
|
## [0.16.1] - 2021-12-13
|
10
19
|
|
11
20
|
### Added
|
|
@@ -23,7 32,7 @@ NOTE: Please read PR #458 for upgrade instructions.
|
23
32
|
- Add retried_at field for Sidekiq compatibility #450 by @ananthakumaran
|
24
33
|
- Add apis to support exq_ui #452 by @ananthakumaran
|
25
34
|
- Add documentation about mode: :enqueuer and Exq.Enqueuer.queue_in #456 by @dbernheisel
|
26
|
- - Add api to immediatly enqeueue jobs from retry/scheduled queue #461 by @ananthakumaran
|
35
|
- Add api to immediately enqeueue jobs from retry/scheduled queue #461 by @ananthakumaran
|
27
36
|
- Add api to re-enqueue dead job #462 by @ananthakumaran
|
28
37
|
|
29
38
|
### Changed
|
|
@@ -51,7 60,7 @@ NOTE: Please read PR #458 for upgrade instructions.
|
51
60
|
- use Task instead of spawn_link for starting workers #436 by @mitchellhenke
|
52
61
|
|
53
62
|
### Fixed
|
54
|
- - re-enqueue unfinished jobs to the begining of queue on restart #424 by @ananthakumaran
|
63
|
- re-enqueue unfinished jobs to the beginning of queue on restart #424 by @ananthakumaran
|
55
64
|
- Fix for sentinel 0.11.0 #428 by @ananthakumaran
|
56
65
|
- Fixes for generated HTML docs by #442 @kianmeng
|
changed
README.md
|
@@ -71,7 71,7 @@ Add `:exq` to your `mix.exs` deps (replace version with the latest hex.pm packag
|
71
71
|
defp deps do
|
72
72
|
[
|
73
73
|
# ... other deps
|
74
|
- {:exq, "~> 0.16.1"}
|
74
|
{:exq, "~> 0.16.2"}
|
75
75
|
]
|
76
76
|
end
|
77
77
|
```
|
changed
hex_metadata.config
|
@@ -76,4 76,4 @@
|
76
76
|
{<<"optional">>,true},
|
77
77
|
{<<"repository">>,<<"hexpm">>},
|
78
78
|
{<<"requirement">>,<<"~> 1.0">>}]]}.
|
79
|
- {<<"version">>,<<"0.16.1">>}.
|
79
|
{<<"version">>,<<"0.16.2">>}.
|
changed
lib/exq/api.ex
|
@@ -391,7 391,7 @@ defmodule Exq.Api do
|
391
391
|
end
|
392
392
|
|
393
393
|
@doc """
|
394
|
- Re enqueue jobs from retry queue immediatly.
|
394
|
Re enqueue jobs from retry queue immediately.
|
395
395
|
|
396
396
|
Expected args:
|
397
397
|
* `pid` - Exq.Api process
|
|
@@ -478,7 478,7 @@ defmodule Exq.Api do
|
478
478
|
end
|
479
479
|
|
480
480
|
@doc """
|
481
|
- Enqueue jobs from scheduled queue immediatly.
|
481
|
Enqueue jobs from scheduled queue immediately.
|
482
482
|
|
483
483
|
Expected args:
|
484
484
|
* `pid` - Exq.Api process
|
|
@@ -541,4 541,22 @@ defmodule Exq.Api do
|
541
541
|
def retry_job(pid, jid) do
|
542
542
|
GenServer.call(pid, {:retry_job, jid})
|
543
543
|
end
|
544
|
|
545
|
@doc """
|
546
|
Send signal to the given node.
|
547
|
|
548
|
Expected args:
|
549
|
* `pid` - Exq.Api process
|
550
|
* `node_id` - node identifier
|
551
|
* `signal_name` - Name of the signal.
|
552
|
|
553
|
Supported Signals
|
554
|
* TSTP - unsubscibe from all queues
|
555
|
|
556
|
Returns:
|
557
|
* :ok
|
558
|
"""
|
559
|
def send_signal(pid, node_id, signal_name) do
|
560
|
GenServer.call(pid, {:send_signal, node_id, signal_name})
|
561
|
end
|
544
562
|
end
|
changed
lib/exq/api/server.ex
|
@@ -236,6 236,11 @@ defmodule Exq.Api.Server do
|
236
236
|
{:reply, :ok, state}
|
237
237
|
end
|
238
238
|
|
239
|
def handle_call({:send_signal, node_id, signal_name}, _from, state) do
|
240
|
result = JobStat.node_signal(state.redis, state.namespace, node_id, signal_name)
|
241
|
{:reply, result, state}
|
242
|
end
|
243
|
|
239
244
|
def terminate(_reason, _state) do
|
240
245
|
:ok
|
241
246
|
end
|
changed
lib/exq/redis/job_stat.ex
|
@@ -103,6 103,21 @@ defmodule Exq.Redis.JobStat do
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
def node_signal(redis, namespace, node_id, signal_name) do
|
107
|
key = node_info_key(namespace, node_id)
|
108
|
signal_key = "#{key}-signals"
|
109
|
|
110
|
case Connection.qp(redis, [
|
111
|
["MULTI"],
|
112
|
["LPUSH", signal_key, signal_name],
|
113
|
["EXPIRE", signal_key, 60],
|
114
|
["EXEC"]
|
115
|
]) do
|
116
|
{:ok, ["OK", "QUEUED", "QUEUED", [_, 1]]} -> :ok
|
117
|
error -> error
|
118
|
end
|
119
|
end
|
120
|
|
106
121
|
def node_ids(redis, namespace) do
|
107
122
|
Connection.smembers!(redis, nodes_key(namespace))
|
108
123
|
end
|
changed
mix.exs
|
@@ -2,7 2,7 @@ defmodule Exq.Mixfile do
|
2
2
|
use Mix.Project
|
3
3
|
|
4
4
|
@source_url "https://github.com/akira/exq"
|
5
|
- @version "0.16.1"
|
5
|
@version "0.16.2"
|
6
6
|
|
7
7
|
def project do
|
8
8
|
[
|
changed
test/api_test.exs
|
@@ -99,6 99,12 @@ defmodule ApiTest do
|
99
99
|
assert %Process{pid: ^my_pid_str} = processes
|
100
100
|
end
|
101
101
|
|
102
|
test "send signal" do
|
103
|
assert nil == JobStat.node_ping(:testredis, "test", %Node{identity: "host1", busy: 1})
|
104
|
assert :ok = Exq.Api.send_signal(Exq.Api, "host1", "TSTP")
|
105
|
assert "TSTP" == JobStat.node_ping(:testredis, "test", %Node{identity: "host1", busy: 1})
|
106
|
end
|
107
|
|
102
108
|
test "jobs when empty" do
|
103
109
|
assert {:ok, []} = Exq.Api.jobs(Exq.Api)
|
104
110
|
end
|
changed
test/performance_test.exs
|
@@ -85,7 85,7 @@ defmodule PerformanceTest do
|
85
85
|
stop_process(sup)
|
86
86
|
end
|
87
87
|
|
88
|
- test "peformance for flakey workers" do
|
88
|
test "performance for flakey workers" do
|
89
89
|
Process.register(self(), :tester)
|
90
90
|
max_timeout_ms = 2 * 1_000
|
changed
test/worker_test.exs
|
@@ -239,7 239,7 @@ defmodule WorkerTest do
|
239
239
|
# Go through Exit reasons: http://erlang.org/doc/reference_manual/errors.html#exit_reasons
|
240
240
|
|
241
241
|
test "execute invalid module perform" do
|
242
|
- {:ok, worker} = start_worker({"NonExistant", "[]"})
|
242
|
{:ok, worker} = start_worker({"NonExistent", "[]"})
|
243
243
|
assert_terminate(worker, false)
|
244
244
|
end
|
245
245
|
|
|
@@ -253,7 253,7 @@ defmodule WorkerTest do
|
253
253
|
assert_terminate(worker, false)
|
254
254
|
end
|
255
255
|
|
256
|
- test "worker with arithmatic error (badarith) still sends stats" do
|
256
|
test "worker with arithmetic error (badarith) still sends stats" do
|
257
257
|
{:ok, worker} = start_worker({"WorkerTest.BadArithmaticWorker", "[]"})
|
258
258
|
assert_terminate(worker, false)
|
259
259
|
end
|