MCPcopy Create free account
hub / github.com/Rfym21/Qwen2API / _saveAllToRedis

Method _saveAllToRedis

src/utils/data-persistence.js:259–266  ·  view source on GitHub ↗

* 批量保存到 Redis * @private

(accounts)

Source from the content-addressed store, hash-verified

257 const existingIndex = data.accounts.findIndex(account => account.email === email)
258 const existing = existingIndex !== -1 ? data.accounts[existingIndex] : {}
259
260 // 仅写入显式传入的字段;未传字段保留 existing 值。stats 同理——
261 // 避免 token refresh / proxy update 的 partial save 把累计 stats 清零
262 const merged = { ...existing, email }
263 if (accountData.password !== undefined) merged.password = accountData.password
264 if (accountData.token !== undefined) merged.token = accountData.token
265 if (accountData.expires !== undefined) merged.expires = accountData.expires
266 if (accountData.proxy !== undefined) merged.proxy = accountData.proxy ?? null
267 if (accountData.stats !== undefined) merged.stats = accountData.stats
268 if (accountData.statsHistory !== undefined) merged.statsHistory = accountData.statsHistory
269 if (accountData.fingerprint !== undefined) merged.fingerprint = accountData.fingerprint

Callers 1

saveAllAccountsMethod · 0.95

Calls 1

_saveToRedisMethod · 0.95

Tested by

no test coverage detected