Check whether we've actually deleted anything before proceeding with
registration; if we have not deleted anything, it means another customer
has registered that number before this one could.
Signed-off-by: Amolith <amolith@secluded.site>
@@ -317,6 +317,7 @@ class TelSelections
tel, customer.customer_id, @bandwidth_account_id
)
db.exec_defer("DELETE FROM tel_inventory WHERE tel = $1", [tel])
+ .then { |r| raise unless r.cmd_tuples.positive? }
end
end
end