Skip to content

Commit

Permalink
Merge pull request #23 from rabee-inc/feature/batch-getter-cache
Browse files Browse the repository at this point in the history
同じものを何度も取得しないように修正
  • Loading branch information
simiraaaa authored Jun 2, 2023
2 parents d828689 + 8b1fdca commit 8a9a49b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cloudfirestore/batch_getter_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ func (bg *batchGetter) Add(docRef *firestore.DocumentRef, dst any) {
if docRef == nil || docRef.ID == "" || !ValidateDocumentID(docRef.ID) {
return
}
// 既に登録済みの場合は何もしない
if _, ok := bg.docMap[docRef.Path]; ok {
return
}
bg.docMap[docRef.Path] = &batchGetterItem{
docRef: docRef,
data: dst,
Expand Down

0 comments on commit 8a9a49b

Please sign in to comment.