Handle the new #identity message

main
Max Ignatenko 2024-02-22 12:16:24 +00:00
parent 8f32c494f7
commit a28199fb92
3 changed files with 16 additions and 1 deletions

View File

@ -458,6 +458,19 @@ func (c *Consumer) processMessage(ctx context.Context, typ string, r io.Reader,
default: default:
log.Error().Msgf("Unknown #info message %q: %+v", payload.Name, payload) log.Error().Msgf("Unknown #info message %q: %+v", payload.Name, payload)
} }
case "#identity":
payload := &comatproto.SyncSubscribeRepos_Identity{}
if err := payload.UnmarshalCBOR(r); err != nil {
return fmt.Errorf("failed to unmarshal commit: %w", err)
}
exportEventTimestamp(ctx, c.remote.Host, payload.Time)
log.Trace().Str("did", payload.Did).Str("type", typ).Int64("seq", payload.Seq).
Msgf("#identity message: %s seq=%d time=%q", payload.Did, payload.Seq, payload.Time)
resolver.Resolver.FlushCacheFor(payload.Did)
// TODO: fetch DID doc and update PDS field?
default: default:
b, err := io.ReadAll(r) b, err := io.ReadAll(r)
if err != nil { if err != nil {

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/uabluerail/indexer
go 1.21.0 go 1.21.0
require ( require (
github.com/bluesky-social/indigo v0.0.0-20240213052310-89516fdbfe38 github.com/bluesky-social/indigo v0.0.0-20240222031037-d6ed4eb62c91
github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cid v0.4.1
github.com/ipld/go-car v0.6.2 github.com/ipld/go-car v0.6.2
github.com/ipld/go-ipld-prime v0.21.0 github.com/ipld/go-ipld-prime v0.21.0

2
go.sum
View File

@ -7,6 +7,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bluesky-social/indigo v0.0.0-20240213052310-89516fdbfe38 h1:KKXEauaiIkqW9HfChxp/t2tvHSQm8Pbbv/mottywm6g= github.com/bluesky-social/indigo v0.0.0-20240213052310-89516fdbfe38 h1:KKXEauaiIkqW9HfChxp/t2tvHSQm8Pbbv/mottywm6g=
github.com/bluesky-social/indigo v0.0.0-20240213052310-89516fdbfe38/go.mod h1:N3Fv7QoBtarvhoHtGLP2U+my6ZbAetbPMwAFTtRAUrI= github.com/bluesky-social/indigo v0.0.0-20240213052310-89516fdbfe38/go.mod h1:N3Fv7QoBtarvhoHtGLP2U+my6ZbAetbPMwAFTtRAUrI=
github.com/bluesky-social/indigo v0.0.0-20240222031037-d6ed4eb62c91 h1:KuyyafTzRXxTkhFPKKMVyWjbaGK9Q7tO5AjKGaMvDCM=
github.com/bluesky-social/indigo v0.0.0-20240222031037-d6ed4eb62c91/go.mod h1:zheM9Nt+x0CPWv7cQ/16tOFuxDRxr0fDjLTXRNfpKgQ=
github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=