Skip to content

Commit 24c1b0f

Browse files
committed
Deploying to master from @ actix/actix-website@a85b4ff 🚀
1 parent 72d1a99 commit 24c1b0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/server/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</span><span class=c1></span><span class=w> </span><span class=s>&#34;response&#34;</span><span class=w>
2323
</span><span class=w></span><span class=p>}</span><span class=w>
2424
</span></code></pre></div><p>For this reason, any long, non-cpu-bound operation (e.g. I/O, database operations, etc.) should be expressed as futures or asynchronous functions. Async handlers get executed concurrently by worker threads and thus don&rsquo;t block execution:</p><div class=highlight><pre class=chroma><code class=language-rust data-lang=rust><span class=k>async</span><span class=w> </span><span class=k>fn</span> <span class=nf>my_handler</span><span class=p>()</span><span class=w> </span>-&gt; <span class=nc>impl</span><span class=w> </span><span class=n>Responder</span><span class=w> </span><span class=p>{</span><span class=w>
25-
</span><span class=w> </span><span class=n>tokio</span>::<span class=n>time</span>::<span class=n>delay_for</span><span class=p>(</span><span class=n>Duration</span>::<span class=n>from_secs</span><span class=p>(</span><span class=mi>5</span><span class=p>)).</span><span class=k>await</span><span class=p>;</span><span class=w> </span><span class=c1>// &lt;-- Ok. Worker thread will handle other requests here
25+
</span><span class=w> </span><span class=n>tokio</span>::<span class=n>time</span>::<span class=n>sleep</span><span class=p>(</span><span class=n>Duration</span>::<span class=n>from_secs</span><span class=p>(</span><span class=mi>5</span><span class=p>)).</span><span class=k>await</span><span class=p>;</span><span class=w> </span><span class=c1>// &lt;-- Ok. Worker thread will handle other requests here
2626
</span><span class=c1></span><span class=w> </span><span class=s>&#34;response&#34;</span><span class=w>
2727
</span><span class=w></span><span class=p>}</span><span class=w>
2828
</span></code></pre></div><p>The same limitation applies to extractors as well. When a handler function receives an argument which implements <code>FromRequest</code>, and that implementation blocks the current thread, the worker thread will block when running the handler. Special attention must be given when implementing extractors for this very reason, and they should also be implemented asynchronously where needed.</p><h2 id=tls--https>TLS / HTTPS</h2><p>Actix Web supports two TLS implementations out-of-the-box: <code>rustls</code> and <code>openssl</code>.</p><p>The <code>rustls</code> crate feature is for <code>rustls</code> integration and <code>openssl</code> is for <code>openssl</code> integration.</p><div class=highlight><pre class=chroma><code class=language-toml data-lang=toml><span class=p>[</span><span class=nx>dependencies</span><span class=p>]</span>

0 commit comments

Comments
 (0)