Skip to content

Commit

Permalink
chore: bump release version
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyin committed Nov 1, 2024
1 parent df33a70 commit 2daecc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.279",
"version": "2.14.280",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
12 changes: 7 additions & 5 deletions src/store/subs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export const useSubsStore = defineStore('subsStore', {
}
},
async fetchFlows(sub?: Sub[]) {
const asyncGetFlow = async ([url, name, noFlow, hideExpire, showRemaining]) => {
type FlowUrlItem = [string, string, boolean, boolean, boolean];
const asyncGetFlow = async (item: FlowUrlItem) => {
const [url, name, noFlow, hideExpire, showRemaining] = item;
if (noFlow) {
this.flows[url] = { status:'noFlow' };
return false;
Expand All @@ -87,12 +89,12 @@ export const useSubsStore = defineStore('subsStore', {
}
};
// 并发执行所有请求,每4个请求错开150ms发起
const flowsUrlList = getFlowsUrlList(sub || this.subs);
const requests = flowsUrlList.map((item, index) => {
const flowsUrlList = getFlowsUrlList(sub || this.subs) as FlowUrlItem[];
const requests: Promise<void>[] = flowsUrlList.map((item, index) => {
const delay = Math.floor(index / 4) * 150;
return new Promise((resolve) => {
return new Promise<void>((resolve) => {
setTimeout(() => {
asyncGetFlow(item).finally(resolve);
void asyncGetFlow(item).finally(() => resolve());
}, delay);
});
});
Expand Down

0 comments on commit 2daecc6

Please sign in to comment.