alephant-sequencer 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3a700631c4ac5a7dcbb393c5b646c94ff570507
4
- data.tar.gz: 231923e71aa7e8f0d4af03e5f3088b14d8c365d1
3
+ metadata.gz: da4eb17201797a629eaeeac5596eeea58c0ae5ff
4
+ data.tar.gz: 1ca50a3ef5e5cb822d45d8f63cb029765d24abd8
5
5
  SHA512:
6
- metadata.gz: 6ee44b240e0007b839b23069601ace6a2221991f12ca560cdc6ca6c372c9ab20db526f7545a06a56ff337a433fe6fd44cce7b3c8d1a91a03ca26d1e9513104bf
7
- data.tar.gz: a34a2e07fe1b5184ca238a385e29dbbc17a90bc99de6251bffd7a37952500e6549bbe3c1431dc3e153d1fedb2f6bf356ce23d335720d2df674845d96e6daa971
6
+ metadata.gz: c50a39c7b3faab1cf4fd590c40d55188fc1400124045a52dedad92955de88ce09fa4e4000877464675e348e75c2bc9c337e9bfea674f21a7071247ac36abdf6f
7
+ data.tar.gz: 3b3978ea477682fe6735d1f3c1c17a9f87d957e48fae08c8409230b598705eaf9fba5a5c694aa13832b72f8cd23544c8a12a6b5814f88ba7de946764d867e859
@@ -58,8 +58,18 @@ module Alephant
58
58
  put_condition(last_seen_check)
59
59
  )
60
60
  end
61
+
62
+ logger.info("SequenceTable#set_sequence_for: #{value} for #{ident} success!")
61
63
  rescue AWS::DynamoDB::Errors::ConditionalCheckFailedException => e
62
- logger.warn("SequenceTable#set_sequence_for: #{e.message}")
64
+ logger.warn("SequenceTable#set_sequence_for: #{ident} #{e.message}")
65
+ last_seen_check = sequence_for(ident)
66
+
67
+ unless last_seen_check >= value
68
+ logger.info("SequenceTable#set_sequence_for: #{ident} trying again!")
69
+ set_sequence_for(ident, value, last_seen_check)
70
+ else
71
+ logger.warn("SequenceTable#set_sequence_for: #{ident} outdated!")
72
+ end
63
73
  end
64
74
  end
65
75
 
@@ -26,11 +26,13 @@ module Alephant
26
26
  end
27
27
 
28
28
  def sequence(msg, &block)
29
- last_seen_id = get_last_seen
30
29
  block.call(msg)
31
30
 
32
- if sequential?(msg)
31
+ last_seen_id = get_last_seen
32
+ if (last_seen_id || 0) < sequence_id_from(msg)
33
33
  set_last_seen(msg, last_seen_id)
34
+ else
35
+ logger.info("Sequencer#sequence nonsequential message for #{ident}")
34
36
  end
35
37
  end
36
38
 
@@ -42,7 +44,6 @@ module Alephant
42
44
 
43
45
  def set_last_seen(msg, last_seen_check = nil)
44
46
  seen_id = sequence_id_from(msg)
45
- logger.info("Sequencer#set_last_seen: #{seen_id}")
46
47
 
47
48
  @sequence_table.set_sequence_for(
48
49
  ident, seen_id,
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Sequencer
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-sequencer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Kenny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-06 00:00:00.000000000 Z
11
+ date: 2014-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler