@@ 167,6 167,10 @@ end
# Especially if we have the component join MUC for notifications
message(to: /\A#{CONFIG[:component][:jid]}\Z/) {}
+def billable_message(m)
+ !m.body.empty? || m.find("ns:x", ns: OOB.registered_ns).first
+end
+
message do |m|
sentry_hub = new_sentry_hub(m, name: "message")
today = Time.now.utc.to_date
@@ 177,7 181,7 @@ message do |m|
)
EMPromise.all([
customer,
- customer.incr_message_usage,
+ (customer.incr_message_usage if billable_message(m)),
REDIS.exists("jmp_usage_notify-#{customer.customer_id}"),
customer.stanza_from(m)
])