mirror of
https://github.com/PaiGramTeam/luoxu-api-pub.git
synced 2024-11-22 07:08:05 +00:00
don't overwrite status of others with concurrent requests
This commit is contained in:
parent
210e52af12
commit
d29f0fc31c
@ -104,7 +104,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
let concurrency = 0;
|
||||
async function do_search(more?: any) {
|
||||
concurrency += 1;
|
||||
try {
|
||||
abort.abort();
|
||||
abort = new AbortController();
|
||||
if (!group && !islocal) {
|
||||
@ -118,7 +121,7 @@
|
||||
error = "";
|
||||
our_hash_change = true;
|
||||
console.log(
|
||||
`searching ${query} for group ${group}, older than ${more}, from ${sender}`
|
||||
`searching ${query} for group ${group}, older than ${more}, from ${sender}`,
|
||||
);
|
||||
const q = new URLSearchParams();
|
||||
if (group) {
|
||||
@ -158,10 +161,15 @@
|
||||
result = r;
|
||||
}
|
||||
} catch (e) {
|
||||
if (concurrency <= 1) {
|
||||
error = e;
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
our_hash_change = false;
|
||||
} finally {
|
||||
concurrency -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
async function on_group_change() {
|
||||
|
Loading…
Reference in New Issue
Block a user