service_skeleton 0.0.0.30.g32b8169 → 0.0.0.34.g4f6fdb0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c73ba4e02f8bcd6f90caa188e15b3da3bd3fef747a30f8da70ac12881177c179
4
- data.tar.gz: a1e1f008182f70f135c7455725d2e1bf4a7515789512786b2aa58c914bed9299
3
+ metadata.gz: 8e45890d70da0bc9118d5b96a8d697197cfd05fb6463ff3e84f048ceb4246b55
4
+ data.tar.gz: bb5bafb7ce4cd3e68143fbb179fd630cec02e9c2b1587afa7a601513efb826a1
5
5
  SHA512:
6
- metadata.gz: ee7d4bb7bb7f1b84f37fb3d63bc698e632dcad00eaa98e886628106d3966d57ce950499696ea04628fb09f8e1de9b6242069486fc0669be2413278dcf6c8f744
7
- data.tar.gz: 5d75bab29a82cd40083fde69a2d9725273475a45e922d68e2b3b88300215fc3ec0dfea08fa441556235fe48a0879fe5cbff037cf407debd9a3efd5f2710c18aa
6
+ metadata.gz: 68f83da9df7a513d4664c94c01f6c48102012f6b8de6cf89641f48f617441e23d9ffdd408a879f9ca17a39e2debeed55750265b6ee03a16210e66a9d730adb5f
7
+ data.tar.gz: 64ddeaacdb65c61af8c745a4b2acb30857c3481641530e1968d29cf6aea0b29a341ff16d00259d05b8529793012da3b0eda9abd2c82e9b5e3f1a45cfe51f589f
data/README.md CHANGED
@@ -75,6 +75,8 @@ Whatever it is, `ServiceSkeleton` doesn't discriminate. All you have to do is
75
75
  write it in your subclass' `#run` method, and `ServiceSkeleton` will take care
76
76
  of the rest.
77
77
 
78
+ If your `#run` method exits, the service will terminate.
79
+
78
80
 
79
81
  ### STAHP!
80
82
 
@@ -48,6 +48,7 @@ class ServiceSkeleton
48
48
  logger.debug("BackgroundWorker(#{self.class})#start!") { "Background worker thread #{Thread.current.object_id} terminating" }
49
49
  end
50
50
  end
51
+ logger.debug("BackgroundWorker(#{self.class})#start!") { "Background worker thread #{Thread.current.object_id} is now done" }
51
52
  end
52
53
 
53
54
  @bg_worker_op_cv.wait(@bg_worker_op_mutex) until @bg_worker_thread
@@ -61,12 +62,15 @@ class ServiceSkeleton
61
62
  logger.debug("BackgroundWorker(#{self.class})#stop!") { "Terminating worker thread #{@bg_worker_thread.object_id} as requested" }
62
63
 
63
64
  if force == :force
65
+ logger.debug(logloc) { "Forcing termination" }
64
66
  @bg_worker_thread.raise(TerminateBackgroundThread)
65
67
  else
68
+ logger.debug(logloc) { "Gracefully terminating worker thread" }
66
69
  shutdown
67
70
  end
68
71
 
69
72
  begin
73
+ logger.debug(logloc) { "Waiting for worker thread #{@bg_worker_thread.object_id} to finish itself off" }
70
74
  @bg_worker_thread.join unless @bg_worker_thread == Thread.current
71
75
  rescue TerminateBackgroundThread
72
76
  nil
@@ -74,7 +78,7 @@ class ServiceSkeleton
74
78
 
75
79
  @bg_worker_thread = nil
76
80
 
77
- logger.debug("BackgroundWorker(#{self.class})#stop!") { "Worker thread terminated" }
81
+ logger.debug("BackgroundWorker(#{self.class})#stop!") { "Worker thread #{@bg_worker_thread.object_id} terminated" }
78
82
  end
79
83
  end
80
84
 
@@ -83,7 +87,8 @@ class ServiceSkeleton
83
87
  attr_reader :logger
84
88
 
85
89
  def shutdown
86
- @bg_worker_thread.raise(TerminateBackgroundThread)
90
+ logger.debug("BackgroundWorker(#{self.class})#stop!") { "Using default shutdown method" }
91
+ @bg_worker_thread.raise(TerminateBackgroundThread) if @bg_worker_thread
87
92
  end
88
93
  end
89
94
  end
@@ -75,7 +75,7 @@ class ServiceSkeleton
75
75
  th_n = thread_id_map[Thread.current.object_id] || (thread_id_map[Thread.current.object_id] = thread_id_map.length)
76
76
 
77
77
  ts = log_enable_timestamps ? "#{t.utc.strftime("%FT%T.%NZ")} " : ""
78
- "#{ts}##{th_n} #{s[0]} [#{p}] #{m}\n"
78
+ "#{ts}#{$$}##{th_n} #{s[0]} [#{p}] #{m}\n"
79
79
  end
80
80
 
81
81
  @logger.filters = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_skeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.30.g32b8169
4
+ version: 0.0.0.34.g4f6fdb0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-04 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: frankenstein