Handle the new #identity message

This commit is contained in:
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:
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:
b, err := io.ReadAll(r)
if err != nil {