# Managed spell queue **🟡 Intermediate · Lesson 44** Wait for a pooled object instead of failing - managed_spell_mode="queue". A queue pool is limited_quantity with patience: at its limit a meld WAITS for a release, up to managed_spell_timeout_seconds (required for a queue, refused for the other modes). A release hands the waiting meld the released object. When the timeout passes first, the meld raises ManagedSpellExhaustedError naming the queue, its limit and its timeout. The timeout bounds every wait, so a queue never blocks forever: choose it from how long a caller may afford to wait for a turn. ## Before you run Use the [Intermediate guide](../../intermediate/index.md) for prerequisite concepts. Run from a checkout with Melder installed and Python 3.14 free-threading selected. The collection download includes the level's local helper modules. ## Run the saved script ```bash python UX_and_AIX_experiences/02_intermediate/44_managed_spell_queue.py ``` ```powershell py -3.14t UX_and_AIX_experiences/02_intermediate/44_managed_spell_queue.py ``` {download}`Download this collection <../../downloads/intermediate-examples.zip>` · [Source on GitHub](https://github.com/Synaptic724/melder/blob/4b364a338debcb1c010d0f6e9dcbbabb62945ba0/UX_and_AIX_experiences/02_intermediate/44_managed_spell_queue.py) ## Public surface md.Spellbook.bind (managed_spell_mode, managed_spell_limit, managed_spell_timeout_seconds), md.ManagedSpellMode.queue, md.Conduit.meld, md.ManagedSpellExhaustedError (mode, limit, timeout_seconds), md.ReleaseManagedSpell (release, describe), md.Conduit.cleanup ## Code ```{literalinclude} ../../downloads/02_intermediate/44_managed_spell_queue.py :language: python :linenos: ``` ## Check the outcome The script contains its own assertions or demonstrated refusal paths. Run it to evaluate those checks against your installed version. The code above is taken directly from the saved file; no run output is invented here. [More intermediate examples](index.md) · [Level guide](../../intermediate/index.md) ## Related guides - [Managed spell pools](../../intermediate/managed-spells.md) ## API contracts - [Spellbook](../../reference/api/binding/spellbook.md) - [Conduit](../../reference/api/resolution/conduit.md) - [ManagedSpellMode](../../reference/api/resolution/managedspellmode.md) - [ReleaseManagedSpell](../../reference/api/resolution/releasemanagedspell.md) - [ManagedSpellExhaustedError](../../reference/api/errors/managedspellexhaustederror.md)