acpc_table_manager 2.1.2 → 2.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40cdacd266e472effa1e421f0d6a309c9dc4572c
4
- data.tar.gz: f59f137e26e6a42a81564ce9f48d13f43bcd2d3f
3
+ metadata.gz: 5fa5f98954ab8a4efc2090a89478d447a2d2a9c0
4
+ data.tar.gz: 8e2eaa55099066e62d89c583796966ef4432eaa6
5
5
  SHA512:
6
- metadata.gz: 9015fb9855b15b5e0935f2cd7030c5e9027c364caaaca0161226b702c25e543a4e385496e224badaaddb8eb1fff64c8142a0ffb27e28a199b453862c2a4cb9b2
7
- data.tar.gz: a2dc237858e18e7c1344e630765ad93f11abfc659a907822028406c95dc0c40c318992348d59a71db470a74d71069ff012fba36cffea129ae6352bc6b190d6b7
6
+ metadata.gz: 7ec7782bc01519101d88bebc6b16cdffc2333192f8024b220bdf93c0e9b859f9f4652f2f475d9c386084b024df7399662f2682d23931e69856723ff5b5cd3cad
7
+ data.tar.gz: b9ab7094f9e74de741009b8c550cd348b6cd679c26c2ba138c223bcbed48a27fb976236b1ddaea9c558bfb5bdfa21b2717db71b6dc4c9386100d87274008f898
@@ -24,27 +24,45 @@ module AcpcTableManager
24
24
  end
25
25
  end
26
26
 
27
- def self.kill_orphan_proxies(pids, pids_file)
28
- new_pids = []
29
- pids.each do |pid_pair|
30
- if AcpcDealer::process_exists?(pid_pair['proxy']) && !AcpcDealer::process_exists?(pid_pair['dealer'])
31
- AcpcDealer::kill_process pid_pair['proxy']
27
+ def self.kill_process_if_running(pid)
28
+ begin
29
+ AcpcDealer::kill_process pid
30
+ sleep 1 # Give the process a chance to exit
31
+
32
+ if AcpcDealer::process_exists?(pid)
33
+ AcpcDealer::force_kill_process pid
32
34
  sleep 1 # Give the process a chance to exit
33
35
 
34
- if AcpcDealer::process_exists?(pid_pair['proxy'])
35
- AcpcDealer::force_kill_process pid_pair['proxy']
36
- sleep 1 # Give the process a chance to exit
36
+ if AcpcDealer::process_exists?(pid)
37
+ yield if block_given?
38
+ end
39
+ end
40
+ rescue Errno::ESRCH
41
+ end
42
+ end
37
43
 
38
- if AcpcDealer::process_exists?(pid_pair['proxy'])
39
- raise(
40
- StandardError.new(
41
- "Proxy process #{pid_pair['proxy']} couldn't be killed!"
42
- )
44
+ def self.kill_orphan_proxies(pids, pids_file)
45
+ new_pids = []
46
+ pids.each do |pid_pair|
47
+ proxy_running = AcpcDealer::process_exists?(pid_pair['proxy'])
48
+ if proxy_running && AcpcDealer::process_exists?(pid_pair['dealer'])
49
+ new_pids << pid_pair
50
+ elsif proxy_running
51
+ kill_process_if_running pid_pair['proxy'] do
52
+ raise(
53
+ StandardError.new(
54
+ "Proxy process #{pid_pair['proxy']} couldn't be killed!"
43
55
  )
44
- end
56
+ )
45
57
  end
46
58
  else
47
- new_pids << pid_pair
59
+ kill_process_if_running pid_pair['dealer'] do
60
+ raise(
61
+ StandardError.new(
62
+ "Dealer process #{pid_pair['dealer']} couldn't be killed!"
63
+ )
64
+ )
65
+ end
48
66
  end
49
67
  end
50
68
  new_pids
@@ -45,7 +45,7 @@ module AcpcTableManager
45
45
  opponents = match.bots(AcpcTableManager.config.dealer_host)
46
46
 
47
47
  if opponents.empty?
48
- kill_match! match.id.to_s
48
+ force_kill_match! match.id.to_s
49
49
  raise StandardError.new("No opponents found to start for #{match.id.to_s}! Killed match.")
50
50
  end
51
51
 
@@ -1,3 +1,3 @@
1
1
  module AcpcTableManager
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_table_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-01 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pony