aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-04-19 12:56:12 +0200
committerSimon Ser <contact@emersion.fr>2023-04-19 12:56:12 +0200
commit2d651ef901b2c19679651d201d4da4ce157c5ebb (patch)
tree4fdd3af7baf3ba9b7d47c70787d3cac94a545462
parent535bdb2f5281de1cce78e5c81e917cc9a770d523 (diff)
downloadgamja-2d651ef901b2c19679651d201d4da4ce157c5ebb.tar.gz
gamja-2d651ef901b2c19679651d201d4da4ce157c5ebb.zip
components/app: prevent multiple WHO channel commands in parallel
References: https://todo.sr.ht/~emersion/gamja/152
-rw-r--r--components/app.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/components/app.js b/components/app.js
index 2384c33..5c8cd23 100644
--- a/components/app.js
+++ b/components/app.js
@@ -1373,10 +1373,18 @@ export default class App extends Component {
async whoChannelBuffer(target, serverID) {
let client = this.clients.get(serverID);
- await client.who(target, {
- fields: ["flags", "hostname", "nick", "realname", "username", "account"],
- });
+ // Prevent multiple WHO commands for the same channel in parallel
this.setBufferState({ name: target, server: serverID }, { hasInitialWho: true });
+
+ let hasInitialWho = false;
+ try {
+ await client.who(target, {
+ fields: ["flags", "hostname", "nick", "realname", "username", "account"],
+ });
+ hasInitialWho = true;
+ } finally {
+ this.setBufferState({ name: target, server: serverID }, { hasInitialWho });
+ }
}
open(target, serverID, password) {