From 4a4831a403aed1a29aea31e8056e7d1fe4b61f9a Mon Sep 17 00:00:00 2001 From: eliasjpr Date: Tue, 26 Nov 2024 13:04:40 -0500 Subject: [PATCH] Generalizes batch_enqueue method Refines parameter type for batch_enqueue to accommodate various job types, enhancing flexibility in job management. --- src/joobq/job.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joobq/job.cr b/src/joobq/job.cr index 6381d5c..d0b52f1 100644 --- a/src/joobq/job.cr +++ b/src/joobq/job.cr @@ -157,7 +157,7 @@ module JoobQ # ``` # TestJob.batch_enqueue([job1, job2, job3]) # ``` - def self.batch_enqueue(jobs : Array(Job), batch_size : Int32 = 1000) : Nil + def self.batch_enqueue(jobs : Array({{@type}}), batch_size : Int32 = 1000) : Nil raise "Batch size must be greater than 0" if batch_size <= 0 raise "Batch size must be less than or equal to 1000" if batch_size > 1000 JoobQ.store.enqueue_batch(jobs)