Skip to content

Commit

Permalink
chore: extra worker logs
Browse files Browse the repository at this point in the history
  • Loading branch information
smrz2001 committed May 20, 2024
1 parent af1f0a8 commit 0fa7d9c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/services/anchor-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ export class AnchorService {
}

try {
logger.imp(`Anchoring ${batchMessage.data.rids.length} requests from batch ${batchMessage.data.bid}`)
logger.imp(
`Anchoring ${batchMessage.data.rids.length} requests from batch ${batchMessage.data.bid}`
)
const requests = await this.requestRepository.findByIds(batchMessage.data.rids)

const requestsNotReplaced = requests.filter(
Expand Down Expand Up @@ -585,6 +587,7 @@ export class AnchorService {
anchors.length > 0
? await this.anchorRepository.withConnection(trx).createAnchors(anchors)
: 0
logger.imp(`Persisted ${persistedAnchorsCount} anchors to the database`)

await this.requestRepository.withConnection(trx).updateRequests(
{
Expand All @@ -594,12 +597,14 @@ export class AnchorService {
},
acceptedRequests
)
logger.imp(`Updated ${acceptedRequests.length} requests to COMPLETED status`)

// record some metrics about the timing and count of anchors
const completed = new TimeableMetric(SinceField.CREATED_AT)
completed.recordAll(acceptedRequests)
completed.publishStats(METRIC_NAMES.CREATED_SUCCESS_MS)
Metrics.count(METRIC_NAMES.ACCEPTED_REQUESTS, acceptedRequests.length)
logger.imp('Published metrics for completed requests')
return persistedAnchorsCount
},
{ isolationLevel: 'repeatable read' }
Expand Down

0 comments on commit 0fa7d9c

Please sign in to comment.