-
Notifications
You must be signed in to change notification settings - Fork 59
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
Best way to exit a watch on success #15
Comments
I do not understand. you want to this?
|
I tried something very similar by emitting a close signal inside the success block but it didn't seem to exit correctly, I will double check it tomorrow and send the exact code I'm using. |
I tried again today, the trouble seems to be the example code still waits until the timeout time even with success. Emitting the close signal in the data block does not seem to actually close it. What I mean is even if success is after 1 second, the block waits for the entire timeout until the process finishes. e.g. 30 seconds in our case above. Not much difference in the code I'm trying:
|
which the version of k8s module? |
0.4.5 |
you code will run success callback twice. because res.emit('close') will execute error callback.
|
OK I see. However, I just tried that but it still waits for the full 30 seconds even though the deployment finishes after 1-2 seconds (I added some extra logging for that to, I'm hitting the res.emit line ok). My callback code executes fine and exits so it seems the timeout is hanging around without being cancelled on the close signal. |
this is my test code . It works. error callback call only once
|
But how do you exit immediately on success in the |
Came back to this to try to resolve it. I wanted to clarify the problem we have to see if I missed something. I tried to simplify the code to remove the callbacks so I can show the issue we encountered:
Running on the terminal:
Prints this:
Maybe I've missed some mechanism to exit properly. As you can see, the code seems to be finished after ~1 second since the exit function runs but the process itself remains and only exits after another 30 seconds (the timeout time). |
If you do not use unittest run it, I believe it will exit immediately test.js
|
When watching for a success case, such as a deployment finishing, what is the recommended way to signal the close of a watch? I tried a few possible options but nothing exited the watch as expected so far.
The text was updated successfully, but these errors were encountered: