redis-spawn 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/lib/redis/spawn.rb +2 -1
- data/lib/redis/spawn/version.rb +1 -1
- data/test/build_config_test.rb +33 -12
- metadata +2 -3
- data/test/build_config_helper.rb +0 -14
data/Rakefile
CHANGED
data/lib/redis/spawn.rb
CHANGED
@@ -119,7 +119,7 @@ class Redis
|
|
119
119
|
|
120
120
|
# Make sure we clean up after our children and avoid a zombie invasion
|
121
121
|
trap("CLD") do
|
122
|
-
pid = Process.wait
|
122
|
+
pid = Process.wait(-1, Process::WNOHANG)
|
123
123
|
end
|
124
124
|
|
125
125
|
# Start the server
|
@@ -129,6 +129,7 @@ class Redis
|
|
129
129
|
at_exit do
|
130
130
|
# Maybe make this configurable to allow the server to continue after exit
|
131
131
|
self.shutdown!
|
132
|
+
Process.wait(@pid, Process::WNOHANG) if (@pid && @pid != 0)
|
132
133
|
end
|
133
134
|
|
134
135
|
self.pid
|
data/lib/redis/spawn/version.rb
CHANGED
data/test/build_config_test.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require File.expand_path("./build_config_helper", File.dirname(__FILE__))
|
2
1
|
require File.expand_path("./helper", File.dirname(__FILE__))
|
3
2
|
|
4
3
|
test "build_config_line" do
|
@@ -12,25 +11,36 @@ setup do
|
|
12
11
|
@test_config_defaults = <<TEST_CONF_END
|
13
12
|
port 0
|
14
13
|
bind 127.0.0.1
|
15
|
-
unixsocket /tmp/redis-spawned.
|
14
|
+
unixsocket /tmp/redis-spawned.#{PROCESS_PID}.sock
|
16
15
|
loglevel notice
|
17
|
-
logfile /tmp/redis-spawned.
|
16
|
+
logfile /tmp/redis-spawned.#{PROCESS_PID}.log
|
17
|
+
timeout 0
|
18
18
|
databases 16
|
19
19
|
save 900 1
|
20
20
|
save 300 10
|
21
21
|
save 60 10000
|
22
|
+
stop-writes-on-bgsave-error yes
|
22
23
|
rdbcompression yes
|
24
|
+
rdbchecksum yes
|
23
25
|
dbfilename dump.rdb
|
24
|
-
dir /tmp/redis-spawned.
|
26
|
+
dir /tmp/redis-spawned.#{PROCESS_PID}.data
|
25
27
|
appendonly no
|
26
28
|
appendfsync everysec
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
no-appendfsync-on-rewrite no
|
30
|
+
lua-time-limit 5000
|
31
|
+
slowlog-log-slower-than 10000
|
32
|
+
slowlog-max-len 128
|
33
|
+
hash-max-ziplist-entries 512
|
34
|
+
hash-max-ziplist-value 64
|
30
35
|
list-max-ziplist-entries 512
|
31
36
|
list-max-ziplist-value 64
|
32
37
|
set-max-intset-entries 512
|
38
|
+
zset-max-ziplist-entries 128
|
39
|
+
zset-max-ziplist-value 64
|
33
40
|
activerehashing yes
|
41
|
+
client-output-buffer-limit normal 0 0 0
|
42
|
+
client-output-buffer-limit slave 256mb 64mb 60
|
43
|
+
client-output-buffer-limit pubsub 32mb 8mb 60
|
34
44
|
TEST_CONF_END
|
35
45
|
end
|
36
46
|
|
@@ -39,29 +49,40 @@ test "build_config with defaults" do
|
|
39
49
|
end
|
40
50
|
|
41
51
|
setup do
|
42
|
-
@
|
52
|
+
@test_config_overrides = <<TEST_CONF_END
|
43
53
|
port 0
|
44
54
|
bind 127.0.0.1
|
45
55
|
unixsocket /tmp/redis-spawned.override.sock
|
46
56
|
loglevel notice
|
47
57
|
logfile /tmp/redis-spawned.override.log
|
58
|
+
timeout 0
|
48
59
|
databases 8
|
49
60
|
save 900 1
|
50
61
|
save 300 10
|
51
62
|
save 100 1000
|
52
63
|
save 60 10000
|
64
|
+
stop-writes-on-bgsave-error yes
|
53
65
|
rdbcompression no
|
66
|
+
rdbchecksum yes
|
54
67
|
dbfilename dump.rdb
|
55
68
|
dir /tmp/redis-spawned.override.data
|
56
69
|
appendonly no
|
57
70
|
appendfsync everysec
|
58
|
-
|
59
|
-
|
60
|
-
|
71
|
+
no-appendfsync-on-rewrite no
|
72
|
+
lua-time-limit 5000
|
73
|
+
slowlog-log-slower-than 10000
|
74
|
+
slowlog-max-len 128
|
75
|
+
hash-max-ziplist-entries 512
|
76
|
+
hash-max-ziplist-value 64
|
61
77
|
list-max-ziplist-entries 512
|
62
78
|
list-max-ziplist-value 64
|
63
79
|
set-max-intset-entries 512
|
80
|
+
zset-max-ziplist-entries 128
|
81
|
+
zset-max-ziplist-value 64
|
64
82
|
activerehashing yes
|
83
|
+
client-output-buffer-limit normal 0 0 0
|
84
|
+
client-output-buffer-limit slave 256mb 64mb 60
|
85
|
+
client-output-buffer-limit pubsub 32mb 8mb 60
|
65
86
|
TEST_CONF_END
|
66
87
|
end
|
67
88
|
|
@@ -74,7 +95,7 @@ test "build_config with overrides" do
|
|
74
95
|
rdbcompression: "no",
|
75
96
|
dir: "/tmp/redis-spawned.override.data"
|
76
97
|
}
|
77
|
-
assert @
|
98
|
+
assert @test_config_overrides == Redis::SpawnServer.new(start: false, server_opts: overrides).build_config
|
78
99
|
end
|
79
100
|
|
80
101
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-spawn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
@@ -59,7 +59,6 @@ files:
|
|
59
59
|
- test/write_config_test.rb
|
60
60
|
- test/helper.rb
|
61
61
|
- test/spawn_test.rb
|
62
|
-
- test/build_config_helper.rb
|
63
62
|
- test/build_config_test.rb
|
64
63
|
homepage: http://github.com/lichp/redis-spawn
|
65
64
|
licenses: []
|
data/test/build_config_helper.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# Monkeypatch Process to allow for consistent value of Process.pid in tests
|
2
|
-
module Process
|
3
|
-
class << self
|
4
|
-
alias :redis_spawn_original_pid :pid
|
5
|
-
|
6
|
-
def pid
|
7
|
-
if caller[0] =~ /redis\/spawn/
|
8
|
-
return 0
|
9
|
-
else
|
10
|
-
return redis_spawn_original_pid
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|