-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(send signals): Handle machine preparation failed #31
feat(send signals): Handle machine preparation failed #31
Conversation
@@ -97,7 +97,7 @@ def get_signals( | |||
raise NotImplementedError | |||
|
|||
@abstractmethod | |||
def get_machine_by_id(self, machine_id: str) -> MachineModel: | |||
def get_machine_by_id(self, machine_id: str) -> Optional[MachineModel]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sql and mongodb storage implementation already returns Optional[MachineModel] ;
None is returned when the machine does not exist in database
except httpx.HTTPStatusError as exc: | ||
self.logger.error( | ||
f"error while sending signals: {exc} for machine {machine_to_process.machine_id}" | ||
) | ||
if exc.response.status_code == 401: | ||
if attempt_count >= self.max_retries: | ||
self.storage.update_or_create_machine( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I delete this piece of code, because we already update the machine in line 165 (after PR, line 157 before PR).
@rr404 : am I missing something ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ça me semble Ok en effet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
total_sent += sent_signal_ids_count | ||
self.logger.info(f"sent {sent_signal_ids_count} signals") | ||
else: | ||
self.logger.error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Et du coup là on fait rien d'aute que log? sans essayer de lui choper un token ? on prend pour acquis que si ici elle pas a de token c'est qu'il y a eu un aute pb?
Y a t'il un risque qu'elle n'ai pas de token d'ailleurs ? vu que tu hadle le prepare qui fail
except httpx.HTTPStatusError as exc: | ||
self.logger.error( | ||
f"error while sending signals: {exc} for machine {machine_to_process.machine_id}" | ||
) | ||
if exc.response.status_code == 401: | ||
if attempt_count >= self.max_retries: | ||
self.storage.update_or_create_machine( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ça me semble Ok en effet
Fixes #30