Skip to content

Commit

Permalink
fix: πŸ› fix updateReplica of CarMongoDatastore
Browse files Browse the repository at this point in the history
βœ… Closes: #348
  • Loading branch information
siriusyim authored and lovel8 committed Apr 6, 2024
1 parent 30b610f commit beffbb2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/carstore/repo/datastore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ export class CarMongoDatastore extends DataStore<
if (!car.ok) {
return { ok: false, error: car.error }
}

if (
!car.data ||
car.data.length == 0 ||
!car.data[0].replicaInfos
) {
console.log("find car replica failed")
return { ok: true }
}

if (options.replicaIndex >= car.data![0].replicaInfos!.length) {
return {
ok: false,
Expand Down

0 comments on commit beffbb2

Please sign in to comment.