@@ -18,6 +18,13 @@ class Listener {
1818 */
1919 protected $ environment ;
2020
21+ /**
22+ * The amount of seconds to wait before polling the queue.
23+ *
24+ * @var int
25+ */
26+ protected $ sleep = 3 ;
27+
2128 /**
2229 * Create a new queue listener.
2330 *
@@ -83,7 +90,7 @@ public function runProcess(Process $process, $memory)
8390 */
8491 public function makeProcess ($ connection , $ queue , $ delay , $ memory , $ timeout )
8592 {
86- $ string = 'php artisan queue:work %s --queue="%s" --delay=%s --memory=%s --sleep ' ;
93+ $ string = 'php artisan queue:work %s --queue="%s" --delay=%s --memory=%s --sleep=%s ' ;
8794
8895 // If the environment is set, we will append it to the command string so the
8996 // workers will run under the specified environment. Otherwise, they will
@@ -93,7 +100,7 @@ public function makeProcess($connection, $queue, $delay, $memory, $timeout)
93100 $ string .= ' --env= ' .$ this ->environment ;
94101 }
95102
96- $ command = sprintf ($ string , $ connection , $ queue , $ delay , $ memory );
103+ $ command = sprintf ($ string , $ connection , $ queue , $ delay , $ memory, $ this -> sleep );
97104
98105 return new Process ($ command , $ this ->commandPath , null , null , $ timeout );
99106 }
@@ -140,4 +147,25 @@ public function setEnvironment($environment)
140147 $ this ->environment = $ environment ;
141148 }
142149
143- }
150+ /**
151+ * Get the amount of seconds to wait before polling the queue.
152+ *
153+ * @return int
154+ */
155+ public function getSleep ()
156+ {
157+ return $ this ->sleep ;
158+ }
159+
160+ /**
161+ * Set the amount of seconds to wait before polling the queue.
162+ *
163+ * @param int $sleep
164+ * @return void
165+ */
166+ public function setSleep ($ sleep )
167+ {
168+ $ this ->sleep = $ sleep ;
169+ }
170+
171+ }
0 commit comments