anway 0.2.0-aarch64-linux-gnu

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'puma/plugin'
4
+ require 'anway'
5
+ require 'anway/puma/plugin'
6
+
7
+ # `plugin :anway` in config/puma.rb runs bin/anway next to Puma, as
8
+ # config/anway.yml says: the embedded server and the workers, or only the
9
+ # workers. ANWAY_IN_PUMA turns it on or off. Without it, it runs only in
10
+ # development. When anway stops by itself, Puma stops too, so a broken worker
11
+ # is not hidden.
12
+ Puma::Plugin.create do
13
+ def start(launcher)
14
+ @launcher = launcher
15
+
16
+ return unless Anway::Puma::Plugin.enabled?
17
+
18
+ events = launcher.events
19
+
20
+ if events.respond_to?(:after_booted)
21
+ events.after_booted { start_anway }
22
+ events.after_stopped { stop_anway }
23
+ events.before_restart { stop_anway }
24
+ else
25
+ events.on_booted { start_anway }
26
+ events.on_stopped { stop_anway }
27
+ events.on_restart { stop_anway }
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def start_anway
34
+ @stopping = false
35
+ @pid = Process.spawn(*Anway::Puma::Plugin.command)
36
+
37
+ @monitor = Thread.new(@pid) do |pid|
38
+ _, status = Process.wait2(pid)
39
+
40
+ unless @stopping
41
+ log("anway stopped with #{status}, so Puma stops")
42
+ @launcher.stop
43
+ end
44
+ end
45
+
46
+ log("anway started with pid #{@pid}")
47
+ end
48
+
49
+ def stop_anway
50
+ return unless @pid
51
+
52
+ @stopping = true
53
+
54
+ Process.kill('TERM', @pid)
55
+
56
+ Process.kill('KILL', @pid) unless @monitor.join(Anway::Server::STOP_TIMEOUT + 5)
57
+ @monitor.join(5)
58
+ rescue Errno::ESRCH
59
+ nil
60
+ ensure
61
+ @pid = nil
62
+ end
63
+
64
+ def log(message)
65
+ writer = @launcher.respond_to?(:log_writer) ? @launcher.log_writer : @launcher.events
66
+
67
+ writer.log("* #{message}")
68
+ end
69
+ end
Binary file
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: anway
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: aarch64-linux-gnu
6
+ authors:
7
+ - Thadeu
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: logger
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.6'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.6'
26
+ executables:
27
+ - anway
28
+ extensions: []
29
+ extra_rdoc_files: []
30
+ files:
31
+ - LICENSE
32
+ - README.md
33
+ - exe/anway
34
+ - lib/active_job/queue_adapters/anway_adapter.rb
35
+ - lib/anway.rb
36
+ - lib/anway/cli.rb
37
+ - lib/anway/client.rb
38
+ - lib/anway/configuration.rb
39
+ - lib/anway/connection.rb
40
+ - lib/anway/console.rb
41
+ - lib/anway/daemon.rb
42
+ - lib/anway/errors.rb
43
+ - lib/anway/executor.rb
44
+ - lib/anway/job.rb
45
+ - lib/anway/pool.rb
46
+ - lib/anway/puma/plugin.rb
47
+ - lib/anway/queues.rb
48
+ - lib/anway/railtie.rb
49
+ - lib/anway/runner.rb
50
+ - lib/anway/server.rb
51
+ - lib/anway/settings.rb
52
+ - lib/anway/testing.rb
53
+ - lib/anway/version.rb
54
+ - lib/anway/web.rb
55
+ - lib/anway/worker.rb
56
+ - lib/generators/anway/install/install_generator.rb
57
+ - lib/generators/anway/install/templates/anway
58
+ - lib/generators/anway/install/templates/anway.yml
59
+ - lib/puma/plugin/anway.rb
60
+ - libexec/anway-server
61
+ homepage: https://github.com/thadeu/anway-ruby
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '3.4'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubygems_version: 4.0.20
80
+ specification_version: 4
81
+ summary: Ruby and Rails client and worker for the Anway job server
82
+ test_files: []