Skip to content

Commit

Permalink
Remove Tink worker global timeout cli flag:
Browse files Browse the repository at this point in the history
The Tink worker global timeout cli flag doesn't implement
the global timeout defined in a Tink server template correctly.

A single template can have multiple workers. So a single
Tink worker defining a global timeout for all task is
erroneous. It doesn't take the multiple workers idea into account.

A long term solution will need to be implemented. Something that
takes into account multiple workers.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
  • Loading branch information
jacobweinstock committed Apr 12, 2022
1 parent 08a2e12 commit bc632a3
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions cmd/tink-worker/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
retryInterval, _ := cmd.Flags().GetDuration("retry-interval")
retries, _ := cmd.Flags().GetInt("max-retry")
// TODO(displague) is log-level no longer useful?
// logLevel, _ := cmd.Flags().GetString("log-level")
workerID, _ := cmd.Flags().GetString("id")
maxFileSize, _ := cmd.Flags().GetInt64("max-file-size")
timeOut, _ := cmd.Flags().GetDuration("timeout")
user, _ := cmd.Flags().GetString("registry-username")
pwd, _ := cmd.Flags().GetString("registry-password")
registry, _ := cmd.Flags().GetString("docker-registry")
Expand All @@ -57,13 +54,6 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command {
return setupErr
}

ctx := context.Background()
if timeOut > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, timeOut)
defer cancel()
}

conn, err := tryClientConnection(logger, retryInterval, retries)
if err != nil {
return err
Expand Down Expand Up @@ -96,6 +86,7 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command {
worker.WithLogCapture(captureActionLogs),
worker.WithPrivileged(true))

ctx := context.Background()
err = w.ProcessWorkflowActions(ctx)
if err != nil {
return errors.Wrap(err, "worker Finished with error")
Expand All @@ -114,8 +105,6 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command {

rootCmd.Flags().Bool("capture-action-logs", true, "Capture action container output as part of worker logs")

// rootCmd.Flags().String("log-level", "info", "Sets the worker log level (panic, fatal, error, warn, info, debug, trace)")

must := func(err error) {
if err != nil {
logger.Fatal(err)
Expand Down

0 comments on commit bc632a3

Please sign in to comment.