thread_watcher 0.7.0 → 0.7.1
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.
- checksums.yaml +4 -4
- data/README.md +36 -28
- data/lib/thread_watcher/process_watch.rb +1 -1
- data/lib/thread_watcher/version.rb +1 -1
- data/thread_watcher.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9b0bc53f876da8367422fb55bd662be466325aa
|
4
|
+
data.tar.gz: d807ec01f1c8f992a17fa92e4ba531ac86d18ba9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a5f146bf2f34289e4974d8b79181a3055ded44f0af771985c0a517b3a78a0bb8013cf457a0caa0984117d0e4284b28ab2ede31ec3ab53d6bfd993c0ea502aea
|
7
|
+
data.tar.gz: a4b721d97eb8eb5bb24890374e5a57c2432e6a8995b550ea5d41547c72a29d474a2bc3c57cc52b59035289de75002de4116a407a4d88a31cf5e9c06d14e8707e
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# ThreadWatcher
|
2
2
|
|
3
|
-
You need to monitor your threads and kill one specific thread in another part of your application? Then this Gem could be usefull for you.
|
3
|
+
You need to monitor your threads and kill one specific thread or restart them after scheduling in another part of your application? Then this Gem could be usefull for you.
|
4
|
+
|
5
|
+
Build for ruby 1.8.7 and newer.
|
4
6
|
|
5
7
|
|
6
8
|
## Installation
|
@@ -8,7 +10,7 @@ You need to monitor your threads and kill one specific thread in another part of
|
|
8
10
|
hm, yeah. just add this to your Gemfile:
|
9
11
|
|
10
12
|
```ruby
|
11
|
-
gem 'thread_watcher', '~> 0.
|
13
|
+
gem 'thread_watcher', '~> 0.7.0'
|
12
14
|
```
|
13
15
|
|
14
16
|
And then execute:
|
@@ -35,32 +37,7 @@ Run needs a block to work and return the internal process id.
|
|
35
37
|
This could be something like `1452333019`
|
36
38
|
|
37
39
|
If your thread is ok, so let them work.
|
38
|
-
ThreadWatcher starts automaticly a cleaning task to kill dead threads every minute.
|
39
|
-
|
40
|
-
You can also specify your threads with a name if you need it.
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
ThreadWatcher::Monitor.run(name:'My Job') { sleep 10 }
|
44
|
-
```
|
45
|
-
|
46
|
-
You may want to hold a process, to restart them after when he died? So you can use the keep_alive option
|
47
|
-
|
48
|
-
```ruby
|
49
|
-
ThreadWatcher::Monitor.run(name:'My Job', keep_alive: true) { sleep 10 }
|
50
|
-
```
|
51
|
-
|
52
|
-
Now, the process won't be killed when he's done. So you can restart them with
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
ThreadWatcher::Monitor.restart 1452333224
|
56
|
-
```
|
57
|
-
|
58
|
-
But now, you can't kill them with `ThreadWatcher::Monitor.restart 1452333224`.
|
59
|
-
If you want to kill these process then use
|
60
|
-
|
61
|
-
```ruby
|
62
|
-
ThreadWatcher::Monitor.kill! 1452333224
|
63
|
-
```
|
40
|
+
ThreadWatcher starts automaticly a cleaning task to kill all dead threads every minute. You can skip this feature with the option key `keep alive`
|
64
41
|
|
65
42
|
Let's say you type something like
|
66
43
|
|
@@ -96,6 +73,37 @@ And you get a simple overview like
|
|
96
73
|
|
97
74
|
```
|
98
75
|
|
76
|
+
### Options
|
77
|
+
|
78
|
+
There are some options to specify the behaviour of your processes.
|
79
|
+
|
80
|
+
You can also specify your threads with a name if you need it.
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
ThreadWatcher::Monitor.run(name: 'My Job') { sleep 10 }
|
84
|
+
```
|
85
|
+
|
86
|
+
Sometimes you may want to hold a process instead of automaticly killing them after a minute. For statistics or to restart them. So you can use the `keep_alive` option
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
ThreadWatcher::Monitor.run(name:'My Job', keep_alive: true) { sleep 10 }
|
90
|
+
```
|
91
|
+
|
92
|
+
Now, the process won't be killed automaticly when he's done. So you can restart them with
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
ThreadWatcher::Monitor.restart 1452333224
|
96
|
+
```
|
97
|
+
|
98
|
+
But now, you can't kill them manually with `ThreadWatcher::Monitor.kill 1452333224`.
|
99
|
+
If you want to kill these process manually then use
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
ThreadWatcher::Monitor.kill! 1452333224
|
103
|
+
```
|
104
|
+
|
105
|
+
|
106
|
+
|
99
107
|
|
100
108
|
## The MIT License (MIT)
|
101
109
|
|
@@ -41,7 +41,7 @@ module ThreadWatcher
|
|
41
41
|
def initialize
|
42
42
|
@threads = {}
|
43
43
|
@blocks = {}
|
44
|
-
run(:name => 'Cleaning Jobs', :keep_alive => true) { while true; self.clear!; sleep(
|
44
|
+
run(:name => 'Cleaning Jobs', :keep_alive => true) { while true; self.clear!; sleep(60); end; }
|
45
45
|
end
|
46
46
|
|
47
47
|
def run options = {}, &block
|
data/thread_watcher.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
|
13
13
|
spec.summary = %q{Monitor your Threads exactly and kill them from each Point of your Application.}
|
14
|
-
spec.description = %q{You need to monitor your threads and kill one specific thread in another part of your application? Then this Gem could be usefull for you. Use it with any ruby version greater or equal than 1.8.7. See detailed information at the github Page.}
|
14
|
+
spec.description = %q{You need to monitor your threads and kill one specific thread or restart them after scheduling in another part of your application? Then this Gem could be usefull for you. Use it with any ruby version greater or equal than 1.8.7. See detailed information at the github Page.}
|
15
15
|
spec.homepage = "https://github.com/robst/thread_watcher"
|
16
16
|
spec.license = "MIT"
|
17
17
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thread_watcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Starke
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description: You need to monitor your threads and kill one specific thread
|
42
|
-
part of your application? Then this Gem could be
|
43
|
-
ruby version greater or equal than 1.8.7. See detailed
|
44
|
-
Page.
|
41
|
+
description: You need to monitor your threads and kill one specific thread or restart
|
42
|
+
them after scheduling in another part of your application? Then this Gem could be
|
43
|
+
usefull for you. Use it with any ruby version greater or equal than 1.8.7. See detailed
|
44
|
+
information at the github Page.
|
45
45
|
email:
|
46
46
|
- robertst81@gmail.com
|
47
47
|
executables: []
|