mmtop 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,13 +44,17 @@ MMTop::Command.register do |c|
44
44
  end
45
45
 
46
46
  MMTop::Command.register do |c|
47
- c.regexp %r{^k(:?ill)?\s+l(:?ong)?\s+(\d+)}
48
- c.usage "kill long TIME"
49
- c.explain "Kill any queries over TIME seconds"
47
+ c.regexp %r{^k(:?ill)?\s+l(:?ong)?\s+(\d+)\s*(\w*)}
48
+ c.usage "kill long TIME [SERVER]"
49
+ c.explain "Kill any queries over TIME seconds on optional server"
50
50
  c.command do |cmd, config|
51
51
  cmd =~ c.regexp
52
52
  time = $3.to_i
53
- MMTop::Command.kill_prompt(config.all_processes.select { |p| p.time > time && p.sql =~ /select/i })
53
+ server = $4.strip
54
+ list = config.all_processes.select { |p|
55
+ p.time > time && p.sql =~ /select/i && (server.nil? || server.size == 0 || (server == p.host.name))
56
+ }
57
+ MMTop::Command.kill_prompt(list)
54
58
  end
55
59
  end
56
60
 
@@ -19,7 +19,11 @@ module MMTop
19
19
  end
20
20
 
21
21
  def kill!
22
- @host.query("KILL #{@real_id}")
22
+ begin
23
+ @host.query("KILL #{@real_id}")
24
+ rescue Mysql2::Error => e
25
+ puts e
26
+ end
23
27
  end
24
28
 
25
29
  def sql
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmtop
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 3
10
- version: 0.9.3
9
+ - 4
10
+ version: 0.9.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Osheroff
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-20 00:00:00 +00:00
18
+ date: 2012-01-18 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency