jeremyboles-graffic 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/graffic.rb +16 -6
- metadata +1 -1
data/lib/graffic.rb
CHANGED
@@ -43,9 +43,14 @@ class Graffic < ActiveRecord::Base
|
|
43
43
|
def handle_top_in_process_queue!
|
44
44
|
if message = process_queue.receive
|
45
45
|
data = YAML.load(message.to_s)
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
begin
|
47
|
+
record = find(data[:id])
|
48
|
+
record.process!
|
49
|
+
rescue ActiveRecord::RecordNotFound
|
50
|
+
return 'Not found'
|
51
|
+
ensure
|
52
|
+
message.delete
|
53
|
+
end
|
49
54
|
end
|
50
55
|
end
|
51
56
|
|
@@ -54,9 +59,14 @@ class Graffic < ActiveRecord::Base
|
|
54
59
|
if message = upload_queue.receive
|
55
60
|
data = YAML.load(message.to_s)
|
56
61
|
return if data[:hostname] != `hostname`.strip
|
57
|
-
|
58
|
-
|
59
|
-
|
62
|
+
begin
|
63
|
+
record = find(data[:id])
|
64
|
+
record.upload!
|
65
|
+
rescue ActiveRecord::RecordNotFound
|
66
|
+
return 'Not found'
|
67
|
+
ensure
|
68
|
+
message.delete
|
69
|
+
end
|
60
70
|
end
|
61
71
|
end
|
62
72
|
|