Skip to content

Commit 7cabd9e

Browse files
committed
feat: update queue config docs
1 parent 2b3e553 commit 7cabd9e

File tree

1 file changed

+7
-146
lines changed

1 file changed

+7
-146
lines changed

src/docs/utils/queues.md

Lines changed: 7 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -245,161 +245,22 @@ return [
245245
|
246246
*/
247247
'connections' => [
248-
'redis' => [
249-
'host' => _env('REDIS_HOST', '127.0.0.1'),
250-
'port' => _env('REDIS_PORT', '6379'),
251-
'password' => _env('REDIS_PASSWORD', ''),
252-
'dbname' => _env('REDIS_DB', 0),
253-
'after_commit' => false,
254-
],
255-
256248
'database' => [
257249
'driver' => 'database',
258-
'connection' => _env('DB_QUEUE_CONNECTION'),
250+
'connection' => _env('DB_QUEUE_CONNECTION', 'default'),
259251
'table' => _env('DB_QUEUE_TABLE', 'leaf_php_jobs'),
260-
'queue' => _env('DB_QUEUE', 'default'),
261-
'retry_after' => (int) _env('DB_QUEUE_RETRY_AFTER', 90),
262-
'after_commit' => false,
263252
],
264-
],
265253

266-
/*
267-
|--------------------------------------------------------------------------
268-
| Worker config
269-
|--------------------------------------------------------------------------
270-
|
271-
| This section sets up the configuration for your worker. This config
272-
| is used by default when you dispatch a job. You can override this
273-
| config by passing a config array to the dispatch method.
274-
|
275-
*/
276-
'workerConfig' => [
277-
/*
278-
|----------------------------------------------------------------------
279-
| Job execution delay
280-
|----------------------------------------------------------------------
281-
|
282-
| This option allows you to set a delay for when a job should
283-
| be executed. This is useful for scheduling jobs to run
284-
| at a later time.
285-
|
286-
*/
287-
'delay' => 0,
288-
289-
/*
290-
|----------------------------------------------------------------------
291-
| Delay before retry
292-
|----------------------------------------------------------------------
293-
|
294-
| This option allows you to set a delay for when a job should
295-
| be retried. This is useful when you need to setup
296-
| something before retrying a job.
297-
|
298-
*/
299-
'delayBeforeRetry' => 0,
300-
301-
/*
302-
|----------------------------------------------------------------------
303-
| Expire time
304-
|----------------------------------------------------------------------
305-
|
306-
| Set a time limit for how long a job should be kept in the queue.
307-
| This is useful for archiving old jobs that you may need to
308-
| reference later for data or other purposes.
309-
|
310-
*/
311-
'expire' => 60,
312-
313-
/*
314-
|----------------------------------------------------------------------
315-
| Force job execution
316-
|----------------------------------------------------------------------
317-
|
318-
| Force a job to run even if it has expired or reached its retry
319-
| limit. This is useful for jobs that you need to run
320-
| at all costs.
321-
|
322-
*/
323-
'force' => false,
324-
325-
/*
326-
|----------------------------------------------------------------------
327-
| Memory limit
328-
|----------------------------------------------------------------------
329-
|
330-
| This option allows you to set a memory limit for the worker.
331-
| This is useful for preventing memory leaks and
332-
| other memory related issues.
333-
|
334-
*/
335-
'memory' => 128,
336-
337-
/*
338-
|----------------------------------------------------------------------
339-
| Quit when queue is empty
340-
|----------------------------------------------------------------------
341-
|
342-
| Should the worker should quit when the queue is empty?
343-
| By default, the worker will keep running even when
344-
| the queue is empty.
345-
|
346-
*/
347-
'quitOnEmpty' => false,
348-
349-
/*
350-
|----------------------------------------------------------------------
351-
| Worker sleep time
352-
|----------------------------------------------------------------------
353-
|
354-
| Set how long the worker should sleep when the queue is empty.
355-
| This is useful for preventing the worker from consuming
356-
| too much CPU when the queue is empty.
357-
|
358-
*/
359-
'sleep' => 3,
360-
361-
/*
362-
|----------------------------------------------------------------------
363-
| Queue timeout
364-
|----------------------------------------------------------------------
365-
|
366-
| This option allows you to set a timeout for the queue.
367-
| This is useful for preventing the queue from
368-
| running for too long.
369-
|
370-
*/
371-
'timeout' => 60,
372-
373-
/*
374-
|----------------------------------------------------------------------
375-
| Job retry limit
376-
|----------------------------------------------------------------------
377-
|
378-
| This option allows you to set a retry limit for a job.
379-
| This is useful for preventing a job from
380-
| running too many times.
381-
|
382-
*/
383-
'tries' => 3,
254+
'redis' => [
255+
'driver' => 'redis',
256+
'connection' => _env('REDIS_QUEUE_CONNECTION', 'default'),
257+
'queue' => _env('REDIS_QUEUE', 'default'),
258+
],
384259
],
385260
];
386261
```
387262

388-
### Worker Config
389-
390-
Worker config includes the default settings used by your worker when executing a job. These settings can be specified when dispatching a job, but if not specified, the worker will use these settings instead.
391-
392-
| Option | Description |
393-
| --------------- | --------------------------------------------------------------------------------------------- |
394-
| delay | The number of seconds to wait before processing a job. |
395-
| delayBeforeRetry| The number of seconds to wait before retrying a job that has failed. |
396-
| expire | The number of seconds to wait before archiving a job that has not yet been processed. |
397-
| force | Whether to force the worker to process the job, even if it has expired or has reached its maximum number of retries. |
398-
| memory | The maximum amount of memory the worker may consume. |
399-
| quitOnEmpty | Whether the worker should quit when the queue is empty. |
400-
| sleep | The number of seconds to wait before polling the queue for new jobs. |
401-
| timeout | The number of seconds a child process can run before being killed. |
402-
| tries | The maximum number of times a job may be attempted. |
263+
You can change the default queue connection, the queue connections, and the table name for the database queue. You can also add more queue connections if you want to use a different queue backend.
403264

404265
## Deployment
405266

0 commit comments

Comments
 (0)