diff --git a/bin/billing_monthly_cronjob b/bin/billing_monthly_cronjob index 7fcbc417163db7f3e332e42ebeb1a0ed258e7275..bdf5493d712a4112758de536d6a7ec1c0a528ab0 100755 --- a/bin/billing_monthly_cronjob +++ b/bin/billing_monthly_cronjob @@ -86,7 +86,9 @@ EM::Iterator.new(db.exec( <<-SQL SELECT customer_id FROM customer_plans - WHERE expires_at <= LOCALTIMESTAMP + '4 days' + WHERE + expires_at <= LOCALTIMESTAMP + '4 days' AND + expires_at > LOCALTIMESTAMP - INTERVAL '1 month' SQL ), 3).each(nil, -> { one << :done }) do |row, iter| customer = ExpiringCustomer.new(row["customer_id"])