From 1da9ae2e3264b7e9c1258e14c9602178f45e3c6c Mon Sep 17 00:00:00 2001 From: Vivaan Verma <54081925+doublevcodes@users.noreply.github.com> Date: Sat, 1 May 2021 18:10:29 +0100 Subject: Create blocking.md --- bot/resources/tags/blocking.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 bot/resources/tags/blocking.md diff --git a/bot/resources/tags/blocking.md b/bot/resources/tags/blocking.md new file mode 100644 index 000000000..1671ff0d9 --- /dev/null +++ b/bot/resources/tags/blocking.md @@ -0,0 +1,7 @@ +**Why do we need asynchronous programming?** + +Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you did **not** use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming. + +**What is asynchronous programming?** + +An asynchronous programme utilises the `async` and `await` keywords. An asynchronous programme pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. -- cgit v1.2.3