fix patch bgs lexicon null
This commit is contained in:
@@ -1,26 +1,61 @@
|
||||
diff --git a/indexer/indexer.go b/indexer/indexer.go
|
||||
index e3c28ec1..66663de0 100644
|
||||
--- a/indexer/indexer.go
|
||||
+++ b/indexer/indexer.go
|
||||
@@ -104,13 +104,20 @@ func (ix *Indexer) HandleRepoEvent(ctx context.Context, evt *repomgr.RepoEvent)
|
||||
toobig = true
|
||||
diff --git a/events/dbpersist/dbpersist.go b/events/dbpersist/dbpersist.go
|
||||
index 04e9fb87..5e47218e 100644
|
||||
--- a/events/dbpersist/dbpersist.go
|
||||
+++ b/events/dbpersist/dbpersist.go
|
||||
@@ -306,6 +306,12 @@ func (p *DbPersistence) RecordFromRepoCommit(ctx context.Context, evt *comatprot
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+ // Normalize empty string to nil for since field
|
||||
+ // Empty string fails TID validation on consumers
|
||||
+ var since *string
|
||||
+ if evt.Since != nil && *evt.Since != "" {
|
||||
+ since = evt.Since
|
||||
+ }
|
||||
+
|
||||
ix.log.Debug("Sending event", "did", did)
|
||||
if err := ix.events.AddEvent(ctx, &events.XRPCStreamEvent{
|
||||
RepoCommit: &comatproto.SyncSubscribeRepos_Commit{
|
||||
Repo: did,
|
||||
Blocks: slice,
|
||||
Rev: evt.Rev,
|
||||
- Since: evt.Since,
|
||||
+ Since: since,
|
||||
Commit: lexutil.LexLink(evt.NewRoot),
|
||||
Time: time.Now().Format(util.ISO8601),
|
||||
Ops: outops,
|
||||
rer := RepoEventRecord{
|
||||
Commit: &models.DbCID{CID: cid.Cid(evt.Commit)},
|
||||
//Prev
|
||||
@@ -315,7 +321,7 @@ func (p *DbPersistence) RecordFromRepoCommit(ctx context.Context, evt *comatprot
|
||||
Time: t,
|
||||
Rebase: evt.Rebase,
|
||||
Rev: evt.Rev,
|
||||
- Since: evt.Since,
|
||||
+ Since: since,
|
||||
}
|
||||
|
||||
opsb, err := json.Marshal(evt.Ops)
|
||||
@@ -339,6 +345,12 @@ func (p *DbPersistence) RecordFromRepoSync(ctx context.Context, evt *comatproto.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+ // Normalize empty string to nil for since field
|
||||
+ var since *string
|
||||
+ if evt.Since != nil && *evt.Since != "" {
|
||||
+ since = evt.Since
|
||||
+ }
|
||||
+
|
||||
rer := RepoEventRecord{
|
||||
Repo: uid,
|
||||
Type: "repo_sync",
|
||||
@@ -555,6 +567,12 @@ func (p *DbPersistence) hydrateCommit(ctx context.Context, rer *RepoEventRecord)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+ // Normalize empty string to nil for since field
|
||||
+ var since *string
|
||||
+ if rer.Since != nil && *rer.Since != "" {
|
||||
+ since = rer.Since
|
||||
+ }
|
||||
+
|
||||
out := &comatproto.SyncSubscribeRepos_Commit{
|
||||
Seq: int64(rer.Seq),
|
||||
Repo: did,
|
||||
@@ -564,7 +582,7 @@ func (p *DbPersistence) hydrateCommit(ctx context.Context, rer *RepoEventRecord)
|
||||
Rebase: rer.Rebase,
|
||||
Ops: ops,
|
||||
Rev: rer.Rev,
|
||||
- Since: rer.Since,
|
||||
+ Since: since,
|
||||
}
|
||||
|
||||
cs, err := p.readCarSlice(ctx, rer)
|
||||
|
||||
Reference in New Issue
Block a user