-
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
Handling Added events #212
Conversation
4e03b9b
to
52b20a5
Compare
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.
(we also chatted a bit internally)
@@ -388,7 +471,7 @@ def _process_pod_event(self, event: PodEvent) -> None: | |||
elif event["type"] == "DELETED": | |||
self.__handle_deleted_pod_event(event) | |||
|
|||
elif event["type"] == "MODIFIED": | |||
elif event["type"] == "MODIFIED" or event["type"] == "ADDED": |
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.
elif event["type"] == "MODIFIED" or event["type"] == "ADDED": | |
elif event["type"] in {"MODIFIED", "ADDED"}: |
would be a little more idiomatic/shorter, but the current code works as well :)
1ee611d
to
1c84fd1
Compare
# we might see that their are gaps 0.5s because thats how long it will take it to see if there are stuff in the queue | ||
# will give you whats in the queue or wait 0.5 sec to receive events, if no events are received then it will throw the empty exception | ||
# and start again | ||
# I think below might be taking some time to get from a queue an event, should time these two separately |
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.
we can probably remove this since there's no more timers here :)
@@ -210,7 +210,7 @@ def __update_modified_pod(self, pod: V1Pod, event: Optional[PodEvent]) -> None: | |||
|
|||
if pod.status.phase not in SUPPORTED_POD_MODIFIED_EVENT_PHASES: | |||
logger.debug( | |||
f"Got a MODIFIED event for {pod_name} for unhandled phase: " | |||
f"Got a {event['type']} event for {pod_name} for unhandled phase: " |
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 wonder if we can do something like:
def __update_modified_pod(self, pod: V1Pod, event: Optional[PodEvent]) -> None:
...
event_type = event['type'] if event else "null"
...
to handle the null event case (from reconciling)
1c84fd1
to
0beaaac
Compare
This PR currently contains: