this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

handle invalid record cbor

dholms 7b289a2e 8bd90231

+18 -7
+1 -1
nexus/nexus.go
··· 51 51 } 52 52 53 53 func NewNexus(config NexusConfig) (*Nexus, error) { 54 - db, err := gorm.Open(sqlite.Open(config.DBPath+"?_journal_mode=WAL&_busy_timeout=10000&_synchronous=NORMAL&_temp_store=MEMORY&_cache_size=-64000&_wal_autocheckpoint=3000"), &gorm.Config{ 54 + db, err := gorm.Open(sqlite.Open(config.DBPath+"?_journal_mode=WAL&_busy_timeout=10000&_synchronous=NORMAL&_temp_store=MEMORY&_cache_size=8000&_wal_autocheckpoint=3000"), &gorm.Config{ 55 55 Logger: logger.Default.LogMode(logger.Silent), 56 56 }) 57 57 if err != nil {
+9 -4
nexus/processor.go
··· 142 142 143 143 record, err := atdata.UnmarshalCBOR(recBytes) 144 144 if err != nil { 145 + // do not skip here 146 + // we end up storing the CID but not passing the record along in the outbox 145 147 ep.Logger.Error("failed to unmarshal record", "did", evt.Repo, "path", op.Path, "error", err) 146 - continue 147 148 } 148 149 parsed.Record = record 149 150 } ··· 415 416 } 416 417 } 417 418 418 - for _, recEvt := range commit.ToEvts() { 419 + for _, evt := range commit.ToEvts() { 420 + // in the case of invalid record CBOR 421 + if evt.Record == nil && evt.Action != "delete" { 422 + continue 423 + } 419 424 jsonData, err := json.Marshal(&OutboxEvt{ 420 425 Type: "record", 421 - RecordEvt: recEvt, 426 + RecordEvt: evt, 422 427 }) 423 428 if err != nil { 424 429 return err 425 430 } 426 431 outboxBatch = append(outboxBatch, &models.OutboxBuffer{ 427 - Live: recEvt.Live, 432 + Live: evt.Live, 428 433 Data: string(jsonData), 429 434 }) 430 435 }
+8 -2
nexus/resync.go
··· 185 185 186 186 rec, err := atdata.UnmarshalCBOR(blk.RawData()) 187 187 if err != nil { 188 - n.logger.Error("failed to unmarshal record", "path", recPath, "error", err) 189 - return nil 188 + // do not fail here 189 + // we end up storing the CID but not passing the record along in the outbox 190 + n.logger.Error("failed to unmarshal record", "did", did, "path", recPath, "error", err) 190 191 } 191 192 192 193 evt := &RecordEvt{ ··· 251 252 Rkey: evt.Rkey, 252 253 Cid: evt.Cid, 253 254 }) 255 + 256 + // in the case of invalid record CBOR 257 + if evt.Record == nil && evt.Action != "delete" { 258 + continue 259 + } 254 260 255 261 jsonData, err := json.Marshal(&OutboxEvt{ 256 262 Type: "record",