{"record":{"id":"19c7fc5ac21af0b7","repo":"yikart/AiToEarn","slug":"platform-19c7fc","errorCode":null,"errorMessage":"${platform} 当前正在发布中，请稍后再试","messagePattern":"(.+?) 当前正在发布中，请稍后再试","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"project/aitoearn-web/src/store/plugin/store.ts","lineNumber":776,"sourceCode":"\n        // 解析话题\n        const { topics, cleanedString } = parseTopicString(params.desc || '')\n        params.topics = [...new Set(params.topics?.concat(topics))]\n        params.desc = cleanedString\n\n        const accountId = params.accountId\n        // 使用 platform + accountId 作为唯一标识，支持同一平台多账号同时发布\n        const publishKey = getPublishKey(platform, accountId)\n\n        if (status === Status.NOT_INSTALLED)\n          throw new Error(ERROR_MESSAGES.PLUGIN_NOT_INSTALLED)\n\n        if (status !== Status.READY)\n          throw new Error(ERROR_MESSAGES.PLUGIN_NOT_READY)\n\n        // 检查该账号是否正在发布（同一平台不同账号可以同时发布）\n        if (publishingPlatforms.has(publishKey))\n          throw new Error(`${platform} ${ERROR_MESSAGES.PUBLISHING_IN_PROGRESS}`)\n\n        // 标记该账号正在发布，并初始化进度\n        const newPublishingPlatforms = new Set(publishingPlatforms)\n        newPublishingPlatforms.add(publishKey)\n        const newPlatformProgress = new Map(platformProgress)\n        const initialProgress: ProgressEvent = {\n          stage: 'download',\n          progress: 0,\n          message: '准备发布...',\n          timestamp: Date.now(),\n        }\n        newPlatformProgress.set(publishKey, initialProgress)\n\n        set({\n          isPublishing: newPublishingPlatforms.size > 0,\n          publishingPlatforms: newPublishingPlatforms,\n          publishProgress: initialProgress,\n          platformProgress: newPlatformProgress,","sourceCodeStart":758,"sourceCodeEnd":794,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-web/src/store/plugin/store.ts#L758-L794","documentation":"publish() serializes publishing per platform+account via a publishingPlatforms Set keyed by getPublishKey(platform, accountId). If the same account on the same platform already has an in-flight publish, it throws `${platform} ${ERROR_MESSAGES.PUBLISHING_IN_PROGRESS}` to prevent concurrent publishes to one account.","triggerScenarios":"Calling publish() twice with the same platform and accountId while the first publish is still running (publishingPlatforms still contains the publishKey).","commonSituations":"Double-clicking the publish button, retrying while a slow upload/progress loop is still active, or a previous publish that crashed without releasing the publishKey from the set.","solutions":["Disable the publish button while publishingPlatforms.has(publishKey) and re-enable on completion","Wait for the current publish to finish (its onProgress callback reaching completion) before retrying","If a previous publish crashed and left the key stuck, reset the plugin store / reload the page to clear publishingPlatforms"],"exampleFix":"// before\nonClick={() => publish({ platform, accountId })}\n// after\nconst key = getPublishKey(platform, accountId)\nconst { publishingPlatforms } = usePluginStore.getState()\nif (publishingPlatforms.has(key)) return\nonClick={() => publish({ platform, accountId })} // button also disabled while publishing","handlingStrategy":"validation","validationCode":"const key = getPublishKey(platform, accountId)\nconst { publishingPlatforms } = usePluginStore.getState()\nif (publishingPlatforms.has(key)) return // already publishing\nawait publish({ platform, accountId })","typeGuard":"function isPublishKeyBusy(key: string, set: Set<string>): boolean {\n  return set.has(key)\n}","tryCatchPattern":"try {\n  await publish({ platform, accountId })\n} catch (e) {\n  if (e.message.includes('当前正在发布中')) {\n    toast.info('该账号正在发布中，请稍后再试'); return\n  }\n  throw e\n}","preventionTips":["Disable the publish button while a publish for that platform+account is in flight","Debounce/dedupe publish clicks","Ensure failed publishes always remove the publishKey in a finally block to avoid stuck state"],"tags":["concurrency","publish","duplicate-request"],"backgroundTag":"operation-already-in-progress","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}