Skip to content

Conversation

@Szarny
Copy link
Contributor

@Szarny Szarny commented Jun 10, 2022

What this PR does / why we need it:

According to the #3534, it's useful that there is the feature to restart piped from the web console.

To implement this feature, I have added a command handler to handle RestartPiped Command to launcher as a continuation of #3725

Note that this PR does not implement any specific API or UI changes, so there are no user-facing changes.

Which issue(s) this PR fixes:

Fixes partially #3534

Does this PR introduce a user-facing change?:

NONE

@Szarny Szarny self-assigned this Jun 10, 2022
@Szarny Szarny enabled auto-merge (squash) June 10, 2022 08:10
}
}
}
go commandHandler(ctx, l.commandCh)
Copy link
Member

Choose a reason for hiding this comment

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

How about using goroutine with errorGroup instead of creating a simple goroutine?

select {
case <-ticker.C:
// Don't return an error to continue piped execution.
l.enqueueNewCommands(ctx, input)
Copy link
Member

Choose a reason for hiding this comment

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

I feel it's a bit overdo here. Since the command restart piped is not that much and it should be handled immediately on given, making a queue of commands for that is unneeded 🤔 Should we just list commands and restart it instead of sending them to the commandhandler? wdyt @knanao @Szarny

Copy link
Member

Choose a reason for hiding this comment

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

I got your point and I feel it's better but it's up to you since there are already some implementations like this. 🙌

)
logger.Info("received a restart piped command to handle")

l.detectRestartCommand = true
Copy link
Member

@khanhtc1202 khanhtc1202 Jun 10, 2022

Choose a reason for hiding this comment

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

Just feel like this one is not an effective way to implement this feature, we need one ticker (to fetch the commands) and one other ticker(util launcher self checkInterval) to restart the piped. Should we rewrite some part where we restart piped by launcher to reuse that?
ref: current rerun logic https://github.com/pipe-cd/pipecd/blob/master/pkg/app/launcher/cmd/launcher/launcher.go#L248-L262

Copy link
Member

Choose a reason for hiding this comment

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

we can keep the use of this l.detectRestartCommand flag but instead of forking a new go routine to just change this flag value, we can make this in the current enqueueNewCommands, and in execute function, we have shouldRelaunch() function which check for the flag and restart the piped for us 🤔

@khanhtc1202
Copy link
Member

duplicated with #3831 so close this

@khanhtc1202 khanhtc1202 closed this Aug 3, 2022
auto-merge was automatically disabled August 3, 2022 09:46

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants