Permalink
Browse files

Handle Different PID of Coffee and Node

  • Loading branch information...
1 parent 5d0a8d4 commit 3bed73e44dbc0b0f2666300380ec7e4108769b3c @baoshan committed May 18, 2012
Showing with 33 additions and 30 deletions.
  1. +11 −10 test/0.test.coffee
  2. +11 −10 test/1.test.coffee
  3. +11 −10 test/2.test.coffee
View
@@ -48,16 +48,17 @@ describe ["Process #{total_tasks} Tasks of #{total_groups} Groups by #{total_wor
setTimeout probe, 10
it "Should Cleanup Elegantly on Interruption", (done) ->
- allowed_signals = ['SIGINT', 'SIGHUP', 'SIGUSR2']
- random_signal = -> allowed_signals[parseInt Math.random() * allowed_signals.length]
- process.kill random_signal() for process in child_processes
- do get_statistics = ->
- queue.statistics (err, statistics) ->
- return get_statistics() unless statistics.workers is 0
- setTimeout ->
- queue.statistics (err, statistics) ->
- done() if statistics.workers is 0
- , 10
+ queue.workers (err, workers) ->
+ allowed_signals = ['SIGINT', 'SIGHUP', 'SIGUSR2']
+ random_signal = -> allowed_signals[parseInt Math.random() * allowed_signals.length]
+ process.kill worker.pid, random_signal() for worker in workers
+ do get_statistics = ->
+ queue.statistics (err, statistics) ->
+ return get_statistics() unless statistics.workers is 0
+ setTimeout ->
+ queue.statistics (err, statistics) ->
+ done() if statistics.workers is 0
+ , 10
it "Should Dump Incremental Numbers", (done) ->
for group in [0 .. total_groups - 1]
View
@@ -51,16 +51,17 @@ describe ["Process #{total_tasks} Tasks of #{total_groups} Groups by #{total_wor
setTimeout probe, 10
it "Should Cleanup Elegantly on Interruption", (done) ->
- allowed_signals = ['SIGINT', 'SIGHUP', 'SIGUSR2']
- random_signal = -> allowed_signals[parseInt Math.random() * allowed_signals.length]
- process.kill random_signal() for process in child_processes
- do get_statistics = ->
- queue.statistics (err, statistics) ->
- return get_statistics() unless statistics.workers is 0
- setTimeout ->
- queue.statistics (err, statistics) ->
- done() if statistics.workers is 0
- , 10
+ queue.workers (err, workers) ->
+ allowed_signals = ['SIGINT', 'SIGHUP', 'SIGUSR2']
+ random_signal = -> allowed_signals[parseInt Math.random() * allowed_signals.length]
+ process.kill worker.pid, random_signal() for worker in workers
+ do get_statistics = ->
+ queue.statistics (err, statistics) ->
+ return get_statistics() unless statistics.workers is 0
+ setTimeout ->
+ queue.statistics (err, statistics) ->
+ done() if statistics.workers is 0
+ , 10
it "Should Dump Incremental Numbers", (done) ->
for group in [0 .. total_groups - 1]
View
@@ -83,16 +83,17 @@ describe "Process #{total_tasks} Tasks of #{total_groups} Groups by #{total_work
setTimeout stats, 10
it "Should Cleanup Elegantly on Interruption", (done) ->
- allowed_signals = ['SIGINT', 'SIGHUP', 'SIGUSR2']
- random_signal = -> allowed_signals[parseInt Math.random() * allowed_signals.length]
- process.kill random_signal() for process in child_processes
- do get_statistics = ->
- queue.statistics (err, statistics) ->
- return get_statistics() unless statistics.workers is 0
- setTimeout ->
- queue.statistics (err, statistics) ->
- done() if statistics.workers is 0
- , 10
+ queue.workers (err, workers) ->
+ allowed_signals = ['SIGINT', 'SIGHUP', 'SIGUSR2']
+ random_signal = -> allowed_signals[parseInt Math.random() * allowed_signals.length]
+ process.kill worker.pid, random_signal() for worker in workers
+ do get_statistics = ->
+ queue.statistics (err, statistics) ->
+ return get_statistics() unless statistics.workers is 0
+ setTimeout ->
+ queue.statistics (err, statistics) ->
+ done() if statistics.workers is 0
+ , 10
it "Should Dump Incremental Numbers", (done) ->
for group in [0 .. total_groups - 1]

0 comments on commit 3bed73e

Please sign in to comment.