fixes queue size script

This commit is contained in:
Adam Cooke
2017-06-14 09:37:13 +01:00
parent 126a59200a
commit 464bf21e2a

View File

@@ -3,5 +3,5 @@ require_relative '../lib/postal/config'
require 'mysql2'
client = Mysql2::Client.new(:host => Postal.config.main_db.host, :username => Postal.config.main_db.username, :password => Postal.config.main_db.password, :port => Postal.config.main_db.port, :database => Postal.config.main_db.database)
result = client.query("SELECT COUNT(id) as size FROM `queued_messages` WHERE retry_after IS NULL OR retry_after > ADDTIME(UTC_TIMESTAMP(), '30')")
result = client.query("SELECT COUNT(id) as size FROM `queued_messages` WHERE retry_after IS NULL OR retry_after <= ADDTIME(UTC_TIMESTAMP(), '30')")
puts result.to_a.first['size']