diff options
author | 2021-05-01 18:10:29 +0100 | |
---|---|---|
committer | 2021-05-01 18:10:29 +0100 | |
commit | 1da9ae2e3264b7e9c1258e14c9602178f45e3c6c (patch) | |
tree | bcbcc9e552a4676058a9192599b19b3953ba4d85 | |
parent | Merge pull request #954 from ks129/error-handler-test (diff) |
Create blocking.md
-rw-r--r-- | bot/resources/tags/blocking.md | 7 |
1 files changed, 7 insertions, 0 deletions
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. |