Change summary
r2s-bwmsgsv2.rb | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
Detailed changes
@@ -50,7 +50,23 @@ redis = Redis.new(:driver => :hiredis)
while true
timestamps_plus_json_blob = redis.brpoplpush('incoming_messages-' +
ARGV[0], 'pending_messages-' + ARGV[0])
- # TODO: add timestamping here, and MUST include a ./tai call with it
+
+ t = Time.now
+ tai_timestamp = `./tai`.strip
+ tai_yyyymmdd = Time.at(tai_timestamp.to_i).strftime('%Y%m%d')
+ puts "LOG %d.%09d, %s: msg [TODO: ID] sent on %s - incrementing\n" %
+ [t.to_i, t.nsec, tai_timestamp, tai_yyyymmdd]
+
+ day_msg_count = redis.incr(
+ "archived_message-#{ARGV[0]}-#{tai_yyyymmdd}-total"
+ ).then { |total|
+
+ t = Time.now
+ puts "LOG %d.%09d: total msgs for %s-%s now at %s\n" %
+ [t.to_i, t.nsec, tai_yyyymmdd, ARGV[0], total]
+ }
+
+ # TODO: do something with day_msg_count
# TODO: print less stuff in here
puts "TODO - got some stuff: " + timestamps_plus_json_blob