Conversation
|
| ) | ||
| ).toFuture() | ||
|
|
||
| def findApprovedNotSubscribed(): Future[Seq[ApplicationForRisking]] = collection |
There was a problem hiding this comment.
This seems to be exactly what def findReadyToBeSubscribed function is already doing (the implementations seem to be exactly the same).
After closer look it also seems that we're also already logging number of applications to to approve, just with different wording.
Perhaps updating the wording of the existing log statement would be sufficient? Or explaining to the team what to look for in kibana?
Please see:
def processSubscriptions()(using RequestHeader): Future[Unit] =
logger.info("Subscribing approved applications...")
for
applications: Seq[ApplicationForRisking] <- applicationForRiskingRepo.findReadyToBeSubscribed()
applicationCount: Int = applications.size
_ = logger.info(s"Found $applicationCount applications ready to subscribe") <<<<< HERE LOGGING
subscriptionSuccessCount <-
ProcessInSequence.processAllInSequence(applications)(subscribeApplication):
case (ex, application) => logger.error(s"Failed to subscribe agent: ${application.applicationData.applicationReference.value}", ex)
_ = logger.info(s"Subscribed $subscriptionSuccessCount/$applicationCount applications")
yield ()def findReadyToBeSubscribed(): Future[Seq[ApplicationForRisking]] = collection
.find(
Filters.and(
Filters.eq(FieldNames.overallStatus.riskingOutcome, RiskingOutcome.Approved.toBison),
Filters.eq(FieldNames.isSubscribed, false)
)
)
.toFuture(There was a problem hiding this comment.
Good spot! Not sure how I missed that... Yeah I think this may be covered already then, let me have a look on Kibana and see if we can get the numbers we need.
| extends Logging: | ||
| def logApprovedNotSubscribedApplicationCount(): Future[Unit] = { | ||
| applicationForRiskingRepo.findApprovedNotSubscribed().map(applicationCount => | ||
| logger.info(s"Found $applicationCount approved applications that are not subscribed") |
There was a problem hiding this comment.
I think this will most likely always be 0, because subscriptions are processed immediately as part of the risking results processing flow.
By the time this code runs, any approved applications that are ready to be subscribed should already have been picked up and processed.
No description provided.