Skip to content

Commit

Permalink
feat: add protocols column to requests_dnf (#8)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: guillaumemichel <[email protected]>
  • Loading branch information
kasteph and guillaumemichel authored Oct 21, 2024
1 parent a74c824 commit f64f4f1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE requests_denormalized
DROP COLUMN IF EXISTS protocols;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BEGIN;

ALTER TABLE requests_denormalized ADD COLUMN protocols TEXT[];

COMMIT;
11 changes: 9 additions & 2 deletions db/models/requests_denormalized.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions queen.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,12 @@ func (q *Queen) consumeAntsLogs(ctx context.Context) {
} else {
agent = peerstoreAgent.(string)
}
// TODO: uncomment when we need to track protocols
// protocols, _ := q.peerstore.GetProtocols(log.Requester)
// protocolsStr := make([]string, len(protocols))
// for i, p := range protocols {
// protocolsStr[i] = string(p)
// }

request := models.RequestsDenormalized{
RequestStartedAt: log.Timestamp,
Expand All @@ -228,6 +233,7 @@ func (q *Queen) consumeAntsLogs(ctx context.Context) {
KeyMultihash: log.Target.B58String(),
MultiAddresses: db.MaddrsToAddrs(maddrs),
AgentVersion: null.StringFrom(agent),
// Protocols: protocolsStr,
}
requests = append(requests, request)
if len(requests) >= q.resolveBatchSize {
Expand Down

0 comments on commit f64f4f1

Please sign in to comment.