@@ -22,6 +22,7 @@ align="right">
22
22
* [ Fields of the space associated with each queue] ( #fields-of-the-space-associated-with-each-queue )
23
23
* [ Installing] ( #installing )
24
24
* [ Using the queue module] ( #using-the-queue-module )
25
+ * [ Initialization] ( #initialization )
25
26
* [ Creating a new queue] ( #creating-a-new-queue )
26
27
* [ Putting a task in a queue] ( #putting-a-task-in-a-queue )
27
28
* [ Taking a task from the queue ("consuming")] ( #taking-a-task-from-the-queue-consuming )
@@ -302,14 +303,28 @@ build and install.
302
303
303
304
# Using the ` queue ` module
304
305
306
+ ## Initialization
305
307
``` lua
306
308
queue = require ' queue'
307
309
```
308
310
309
311
The request "require 'queue'" causes automatic creation of
310
312
the ` _queue ` space, unless it already exists. The same request
311
313
also sets the necessary space triggers and other objects
312
- associated with queues.
314
+ associated with queues.
315
+ If the instance hasn't been configured yet (` box.cfg() ` hasn't been called),
316
+ the initialization of the queue module will be deferred until the instance will
317
+ be configured ("lazy start"). For a good work of the queue, it's necessary to
318
+ run the instance in rw mode. If the instance run in ro mode, the initialization
319
+ of the queue will be deferred until the instance will be configured in rw mode.
320
+ After the instance has been started in rw mode and the queue has been
321
+ initialized, it's a bad idea to switch it to ro mode. In the case, an attempt to
322
+ do something with a persistent ("temporary" option set to false) queue will fail
323
+ (a temporary queue will work fine). In addition, in the case of mode has been
324
+ switched, triggers may fail (` _on_consumer_disconnect ` for example), which may
325
+ cause an inconsistent state of the queue. As for the core drivers that use
326
+ background fibers (fifottl, limfifottl, utubettl) - they check the instance mode
327
+ on each iteration and will wait until the instance will be switched to rw mode.
313
328
314
329
## Creating a new queue
315
330
0 commit comments