No crash when there are no new transactions to process

Stephen Paul Weber created

Found during initial migration, when a request comes in and it turns out there
are no new transactions, we should not try to set nothing to Redis since that
will throw an exception.

Change summary

config.ru | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Detailed changes

config.ru 🔗

@@ -179,7 +179,11 @@ class UnknownTransactions
 				LEFT JOIN transactions USING (transaction_id)
 			WHERE transactions.transaction_id IS NULL
 		SQL
-		new(customer_id, rows.map { |row| row["transaction_id"] })
+		self.for(customer_id, rows.map { |row| row["transaction_id"] })
+	end
+
+	def self.for(customer_id, transaction_ids)
+		transaction_ids.empty? ? None.new : new(customer_id, transaction_ids)
 	end
 
 	def initialize(customer_id, transaction_ids)
@@ -193,6 +197,10 @@ class UnknownTransactions
 			*@transaction_ids.flat_map { |txid| [txid, @customer_id] }
 		)
 	end
+
+	class None
+		def enqueue!; end
+	end
 end
 
 class JmpPay < Roda