forked from guydavis/chiadog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Events: Bring back the found proof notifications
closes martomi#167 closes martomi#182 The wallet events that were supposed to replace these notifications do not work in many of the scenarious that chiadog operates in. This commit reverses the removal of the found proof notifications.
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# std | ||
import logging | ||
from typing import Optional | ||
|
||
# project | ||
from src.notifier import Event, EventService, EventType, EventPriority | ||
from . import HarvesterConditionChecker | ||
from ...parsers.harvester_activity_parser import HarvesterActivityMessage | ||
|
||
|
||
class FoundProofs(HarvesterConditionChecker): | ||
"""Check if any proofs were found.""" | ||
|
||
def __init__(self): | ||
logging.info("Enabled check for found proofs.") | ||
|
||
def check(self, obj: HarvesterActivityMessage) -> Optional[Event]: | ||
if obj.found_proofs_count > 0: | ||
message = f"Found {obj.found_proofs_count} proof(s)!" | ||
logging.info(message) | ||
return Event( | ||
type=EventType.USER, priority=EventPriority.LOW, service=EventService.HARVESTER, message=message | ||
) | ||
|
||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters