acts_as_service 0.0.3 → 0.0.4
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.
- data/README.rdoc +0 -3
- data/acts_as_service.gemspec +2 -2
- data/lib/acts_as_service.rb +15 -0
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -10,9 +10,6 @@ Limitations:
|
|
10
10
|
* only been tested while running inside a Rails application
|
11
11
|
(e.g. script/runner MySrv.start). should work if you just specify a pidfile
|
12
12
|
explicitly, but needs a little testing
|
13
|
-
* smooth shutdown depends on your work method returning frequently (however
|
14
|
-
long you run without returning from perform_work_chunk is how long it might
|
15
|
-
take for the service to shut down
|
16
13
|
|
17
14
|
Allows you to:
|
18
15
|
* start, stop, restart your process
|
data/acts_as_service.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_service}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Percival"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-17}
|
13
13
|
s.description = %q{A gem with a mixin to let you turn a class into something that runs like a service,
|
14
14
|
which you can MyService.start, MyService.stop, and MyService.restart. It tracks
|
15
15
|
its own pid. For now, pretty sure it requires that the class is running inside
|
data/lib/acts_as_service.rb
CHANGED
@@ -37,6 +37,13 @@
|
|
37
37
|
# code to initiate a shutdown (don't just exit() because there's pidfile
|
38
38
|
# cleanup etc. to peform).
|
39
39
|
#
|
40
|
+
# if you'd like to have long-running work chunks that periodically check
|
41
|
+
# for shutdowns, you can call _shutting_down? at any point, which will
|
42
|
+
# return true if a shutdown has been initiated. However, recommend putting
|
43
|
+
# reasonable amounts of work in each chunk and letting this service
|
44
|
+
# infrastructure manage the decision-making about shutting down...it'll
|
45
|
+
# in general keep your code cleaner.
|
46
|
+
#
|
40
47
|
# # my_service.rb:
|
41
48
|
#
|
42
49
|
# require 'acts_as_service'
|
@@ -302,6 +309,14 @@ module ActsAsService
|
|
302
309
|
return _pid == _pid_file_pid
|
303
310
|
end
|
304
311
|
|
312
|
+
|
313
|
+
# returns true if the service is in the process of shutting down. let
|
314
|
+
# subclasses access if they'd like
|
315
|
+
#---------------------------------------------------------------------------
|
316
|
+
def _shutting_down?
|
317
|
+
ACTS_AS_SERVICE_SHUTTING_DOWN == _status
|
318
|
+
end
|
319
|
+
|
305
320
|
end
|
306
321
|
end
|
307
322
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Percival
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-17 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|