Skip to content

Feat: reconnect socket in case of failure in socket output #17

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

Merged
merged 11 commits into from
Jan 6, 2022

Conversation

PierreRustOrange
Copy link
Contributor

@PierreRustOrange PierreRustOrange commented Dec 14, 2021

This PR is meant to fix #11 and is still a work in progress and should not be merged yet !

The basic mechanism works but there are some missing things:

  • avoid blocking the actor when attempting to reconnect
  • implement exponential back-off to avoid hammering the server and the network with connection attempts.
  • What to do after a specified number of unsuccessful attempts ? quit and stops the sensor ?

Otherwise the sensor stops when the socket output write to an already
closed socket.
This does work but is still a work in progress and lacks proper handling
of corner cases.
Retry should be implemented by the caller, not in `socket_connection`.
Instead, `socket_initialize` now implements a retry loop.
When writing a message on the socket fails, start the reconnection
mechanism.
It is supposed to be good practice to create a new socket every time we
try to connect, instead of reusing the previous one.
@PierreRustOrange
Copy link
Contributor Author

PierreRustOrange commented Dec 16, 2021

hum, there has been a full reformat on storage_socket.c in commit 256b54e , and I now have conflicts all over the file, that's quite painful to merge :(

Is there a recommended / required formatting tool, in order to avoid such issue ?

By the way, the new formatting style of this file is now different from the style in all other files... Is that expected ? For example:

  • indentation is now 2 space and not 4
  • { and } are not a their own line,
  • etc.

Merge mostly due to full reformat on storage_socket.c
@ldesauw
Copy link
Contributor

ldesauw commented Dec 16, 2021

Sorry, I fixed a warning treated as an error (two declaration on a same line) and it seams that my auto-format did some nasty things...
They were no significative change so you can force your commits.
For future commits, compilation warning are treated as error by the CI. We are using a lsp to detect those errors before hand.

@PierreRustOrange
Copy link
Contributor Author

ok, I've pushed a merge where I force the previous formatting style.

I'm afraid I have reintroduced the two declarations on the same line, I'll push a fix for that but I don't see the CI complaining, where can I find that ?

Still, it would be a good thing to agree on a common tool for formatting, I'm clearly not sure my formatting is consistent either ...

@ldesauw ldesauw merged commit 0402041 into powerapi-ng:master Jan 6, 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.

Sensor does connect to the formula after disconnection
2 participants