hawking 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/hawking.rb +5 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7485bb68a0e24f8a22dc243e5fd62e2ebd4aacb
|
4
|
+
data.tar.gz: 19dcdab3aa91a5729151646d15d3611c05cd0f9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69dca7de145aa92aad05bdd6bed9f9e49b01c12691c33619e6ff232bc9c2e2e62498e746fc53067ff55189f0f6f7db4fffd3527d700028f6d274d0cf66bad21e
|
7
|
+
data.tar.gz: b40b7f4d5ece079ae91c0e4afeb0a6ef45b3e35059db8eefea1435d60b60f9a574d7d21abf234b5bec4cc5499ff16c6f05c29f8b8a9e6b8dd72792dc450aef0c
|
data/Gemfile.lock
CHANGED
data/lib/hawking.rb
CHANGED
@@ -5,10 +5,10 @@ require "timeout"
|
|
5
5
|
module Hawking
|
6
6
|
extend self
|
7
7
|
|
8
|
-
VERSION = "0.
|
8
|
+
VERSION = "0.3"
|
9
9
|
|
10
10
|
def run
|
11
|
-
puts "Working #{@@jobs.size} jobs: [ #{@@jobs.keys.join(' ')} ]
|
11
|
+
puts "Working #{@@jobs.size} jobs: [ #{@@jobs.keys.join(' ')} ]"
|
12
12
|
|
13
13
|
server = TCPServer.open "127.0.0.1", 4481
|
14
14
|
|
@@ -17,12 +17,11 @@ module Hawking
|
|
17
17
|
|
18
18
|
def work_jobs(server)
|
19
19
|
Thread.start(server.accept) do |listener|
|
20
|
+
job = JSON.parse listener.gets, symbolize_names: true
|
21
|
+
puts "Working on #{job[:queue]} (#{job[:data]})"
|
22
|
+
|
20
23
|
begin
|
21
24
|
Timeout::timeout(20) do
|
22
|
-
puts "Working on #{job[:queue]} (#{job[:data]})\r"
|
23
|
-
|
24
|
-
job = JSON.parse listener.gets, symbolize_names: true
|
25
|
-
|
26
25
|
handler = @@jobs[job[:queue]]
|
27
26
|
handler.call(job[:data])
|
28
27
|
end
|