stalker 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/VERSION +1 -1
- data/lib/stalker.rb +4 -4
- metadata +2 -2
data/README.md
CHANGED
@@ -51,16 +51,16 @@ Stalker:
|
|
51
51
|
Now run a worker using the stalk binary:
|
52
52
|
|
53
53
|
$ stalk jobs.rb
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
Working 3 jobs: [ email.send post.cleanup.all post.cleanup ]
|
55
|
+
Working send.email (email=hello@example.com)
|
56
|
+
Finished send.email in 31ms
|
57
57
|
|
58
58
|
Stalker will log to stdout as it starts working each job, and then again when the job finishes including the ellapsed time in milliseconds.
|
59
59
|
|
60
60
|
Filter to a list of jobs you wish to run with an argument:
|
61
61
|
|
62
62
|
$ stalk jobs.rb post.cleanup.all,post.cleanup
|
63
|
-
|
63
|
+
Working 2 jobs: [ post.cleanup.all post.cleanup ]
|
64
64
|
|
65
65
|
In a production environment you may run one or more high-priority workers (limited to short/urgent jobs) and any number of regular workers (working all jobs). For example, two workers working just the email.send job, and four running all jobs:
|
66
66
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
data/lib/stalker.rb
CHANGED
@@ -105,18 +105,18 @@ module Stalker
|
|
105
105
|
''
|
106
106
|
end
|
107
107
|
|
108
|
-
log [ "
|
108
|
+
log [ "Working", name, args_flat ].join(' ')
|
109
109
|
@job_begun = Time.now
|
110
110
|
end
|
111
111
|
|
112
|
-
def log_job_end(name,
|
112
|
+
def log_job_end(name, failed=false)
|
113
113
|
ellapsed = Time.now - @job_begun
|
114
114
|
ms = (ellapsed.to_f * 1000).to_i
|
115
|
-
log "
|
115
|
+
log "Finished #{name} in #{ms}ms #{failed ? ' (failed)' : ''}"
|
116
116
|
end
|
117
117
|
|
118
118
|
def log(msg)
|
119
|
-
puts
|
119
|
+
puts msg
|
120
120
|
end
|
121
121
|
|
122
122
|
def log_error(msg)
|