fix(auction): harden lifecycle and durable bid storage
Serialize lifecycle changes and make cancellation, deadlines, and match side effects recoverable and idempotent. Archive accepted bids durably, quarantine invalid payloads, and preserve compatibility with empty round IDs. Synchronize HTTP polling and socket state with scoped resync events. Add cancellation cleanup index migration and regression coverage. Validated with 744 API tests, 65 Redis integration tests, and 28 Mongo integration tests.
This commit is contained in:
1 parent
f2eec479d9
commit
f649490cd2
55 files changed
+5374
-522
No files matched your search
@@ -40,6 +40,7 @@ import {
|
||||
useDevCaptainTeamIndex,
|
||||
} from "../config";
|
||||
import { ApiError } from "../lib/api";
|
||||
import { mergeAuctionState } from "../api/auction-state";
|
||||
import {
|
||||
championDisplayName,
|
||||
championIconUrl,
|
||||
@@ -152,7 +153,10 @@ function pickLatestAuction(
|
||||
const socketRevision = getAuctionRevision(socketAuction);
|
||||
const queryRevision = getAuctionRevision(queryAuction);
|
||||
if (socketRevision !== null && queryRevision !== null) {
|
||||
return queryRevision > socketRevision ? queryAuction : socketAuction;
|
||||
// Polling can repair a partial socket state at the same revision.
|
||||
return queryRevision >= socketRevision
|
||||
? mergeAuctionState(socketAuction, queryAuction)
|
||||
: mergeAuctionState(queryAuction, socketAuction);
|
||||
}
|
||||
}
|
||||
return getAuctionUpdatedAt(queryAuction) > getAuctionUpdatedAt(socketAuction)
|
||||
@@ -1901,6 +1905,10 @@ export default function AuctionPage() {
|
||||
cancelConfirmInputRef.current?.focus();
|
||||
}, [showCancelModal]);
|
||||
|
||||
const { syncPolledAuctionState } = socket;
|
||||
useEffect(() => {
|
||||
syncPolledAuctionState(auctionQuery.data);
|
||||
}, [auctionQuery.data, syncPolledAuctionState]);
|
||||
const liveAuction = pickLatestAuction(socket.auction, auctionQuery.data);
|
||||
const auctionState = useMemo(
|
||||
() =>
|
||||
@@ -2517,7 +2525,7 @@ export default function AuctionPage() {
|
||||
</h2>
|
||||
<p className="mt-2 text-sm leading-6 text-base-content/60">
|
||||
정말 경매를 취소하고 모집 상태로 되돌리시겠습니까? 경매
|
||||
데이터, 입찰 기록, 팀 배정 정보가 삭제됩니다.
|
||||
진행 데이터와 팀 배정 정보가 초기화됩니다.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user