Skip to content

Commit

Permalink
Deploy preview for PR 149 🛫
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosschroh committed Dec 18, 2023
1 parent 01408ea commit c1e3155
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
Binary file modified pr-preview/pr-149/sitemap.xml.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion pr-preview/pr-149/test_client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ <h2 id="defining-extra-topics">Defining extra topics</h2>

<span class="ne">ValueError</span><span class="p">:</span> <span class="n">You</span> <span class="n">might</span> <span class="n">be</span> <span class="n">trying</span> <span class="n">to</span> <span class="n">get</span> <span class="n">the</span> <span class="n">topic</span> <span class="n">target</span><span class="o">-</span><span class="n">topic</span> <span class="n">outside</span> <span class="n">the</span> <span class="err">`</span><span class="n">client</span> <span class="k">async</span> <span class="n">context</span><span class="err">`</span> <span class="ow">or</span> <span class="n">trying</span> <span class="n">to</span> <span class="n">get</span> <span class="n">an</span> <span class="n">event</span> <span class="kn">from</span> <span class="nn">an</span> <span class="n">empty</span> <span class="n">topic</span> <span class="n">target</span><span class="o">-</span><span class="n">topic</span><span class="o">.</span> <span class="n">Make</span> <span class="n">sure</span> <span class="n">that</span> <span class="n">the</span> <span class="n">code</span> <span class="ow">is</span> <span class="n">inside</span> <span class="n">the</span> <span class="k">async</span> <span class="n">contextand</span> <span class="n">the</span> <span class="n">topic</span> <span class="n">has</span> <span class="n">events</span><span class="o">.</span>
</code></pre></div>
<p>We can solve this with a <code>delay</code> (<code>await asyncio.slpeep(...)</code>) inside the <code>async with</code> context to give time to the <code>TestStreamClient</code> to create the topic, however if the buisness logic
<p>We can solve this with a <code>delay</code> (<code>await asyncio.sleep(...)</code>) inside the <code>async with</code> context to give time to the <code>TestStreamClient</code> to create the topic, however if the buisness logic
inside the <code>consume</code> is slow we need to add more delay, then it will become a <code>race condition</code>. </p>
<p>To proper solve it, we can specify to the <code>TestStreamClient</code> the extra topics that we need during the test cycle.</p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">pytest</span>
Expand Down

0 comments on commit c1e3155

Please sign in to comment.