Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

send a notification on crawler success/failure #421

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aquibbaig
Copy link
Collaborator

For #419

) {
parent::__construct($projectRepository, $logger);
$this->repoCrawlerRegistry = $repoCrawlerFactory;
$this->entityManager = $entityManager;
$this->notificationCreator = $notificationCreatorService;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use consistent naming: call the member variable notificationCreatorService as well.

@@ -90,6 +117,21 @@ protected function processProject(Project $project) : bool
// Ignore -- we're already in the error handling path.
// The project will most likely remain in the "in processing"
// state.
// Send a notification that the project cannot be processed
$users = new ArrayCollection();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not simply an array?

->setType("crawler_success")
->setRecipient($user);
$this->notificationCreator->createNotification($notification);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only send a notification in case of a failure.

} else {
$users->add($project->getParentUser());
}
foreach ($users as $user) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding a helper function to the NotificationCreatorService class, e.g. notifyProjectOwners($project, $notification), that wraps this functionality?

foreach ($users as $user) {
$notification = new Notification();
$notification->setSubject("Crawler Failure")
->setMessage("Our RepoCrawler has failed to fetch metrics for your project")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users will get this message without knowing how exactly LibreCores processes their data. They also want to have information on how to fix the problem. To do so, (a) give as much information as possible; include potential error messages we get, (b) include a way to fix the problem (e.g. fix repository permissions in GitHub), and (c) don't use any jargon. "Our RepoCrawler" for example isn't helpful, "On LibreCores, we regularly update your project listing with the latest data from your GitHub repository at github.com/asdf/asdf. Unfortunately, the last time we tried, we encountered this error: xxx. To fix this error, you can xzy"

@imphil imphil force-pushed the master branch 2 times, most recently from 4ea38ec to 68e81af Compare January 5, 2021 23:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants