mirror of
https://github.com/PaiGramTeam/luoxu-api-pub.git
synced 2024-11-29 02:37:19 +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) {
|
async function do_search(more?: any) {
|
||||||
|
concurrency += 1;
|
||||||
|
try {
|
||||||
abort.abort();
|
abort.abort();
|
||||||
abort = new AbortController();
|
abort = new AbortController();
|
||||||
if (!group && !islocal) {
|
if (!group && !islocal) {
|
||||||
@ -118,7 +121,7 @@
|
|||||||
error = "";
|
error = "";
|
||||||
our_hash_change = true;
|
our_hash_change = true;
|
||||||
console.log(
|
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();
|
const q = new URLSearchParams();
|
||||||
if (group) {
|
if (group) {
|
||||||
@ -158,10 +161,15 @@
|
|||||||
result = r;
|
result = r;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (concurrency <= 1) {
|
||||||
error = e;
|
error = e;
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
our_hash_change = false;
|
our_hash_change = false;
|
||||||
|
} finally {
|
||||||
|
concurrency -= 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function on_group_change() {
|
async function on_group_change() {
|
||||||
|
Loading…
Reference in New Issue
Block a user