Skip to content
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/service_status/ab#2950 #148

Merged
merged 8 commits into from
Oct 17, 2022
Merged

Conversation

santiagosalamandri
Copy link
Contributor

This PR allows setting and logging service status based on the servers' statuses:

  • The condition for the service to be ready is that all servers are up and running. This condition is checked every 100 mS.
  • There is a 10-second timeout to notify that not all servers have been started.

@@ -99,6 +100,7 @@ async def start(self):
f"{SDP_MULTICAST_GROUP}%{self.iface} "
f"and port {SDP_SERVER_PORT}"
)
self.ready_event.set()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if there is much value in making read_event a member variable as the only thing time it is used for is to indicate when the udp server is setup? Wouldn't it suffice to pass it through the start() method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 117 to 121
if tls:
self.tls_ready_event.set()
else:
self.tcp_ready_event.set()

Copy link
Contributor

@shalinnijel2 shalinnijel2 Oct 17, 2022

Choose a reason for hiding this comment

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

Same comment regarding udp server. Wouldn't it suffice if we pass in the ready_event Event through the start_tls() or start_no_tls() method - as the state is not required after this - so making it a member variable would not be required. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it could be used in the future to notify when a server failed. It's not needed for now.

@@ -72,6 +73,14 @@ class EVDataContext:
soc: Optional[int] = None # 0-100


class EVSEServiceStatus(str, Enum):
Copy link
Contributor

Choose a reason for hiding this comment

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

As the intention of the enum would be to indicate the status of the entire 15118 service and not just the one EVSE (even though that is what it is being used for at the moment but would change soon), I think it might be better to reflect that - calling it ServiceStatus should do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

async def check_ready_status(self) -> None:
# Wait until all flags are set
while self.check_events() is False:
await asyncio.sleep(0.1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think 100 ms maybe too liberal for this - as servers could potentially be ready in just a few ms - modify this to be 10ms maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@santiagosalamandri santiagosalamandri merged commit d596370 into master Oct 17, 2022
@santiagosalamandri santiagosalamandri mentioned this pull request Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants