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

fix: add --db-workspace-update-propagation-delay CLI flag #789

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"reflect"
"sort"
"time"

"github.com/blang/semver/v4"
"github.com/kong/deck/cprint"
Expand Down Expand Up @@ -206,6 +207,8 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism,
if err != nil {
return err
}
// make sure the DB is updated and ready to receive new workspace queries.
time.Sleep(time.Duration(syncCmdDBWSUpdateDelay) * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

there is no workspace endpoint we could query in a waiting mode for this issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

very good point! We can probably wait for a 200 on /workspaces/<ws> or something like that

}
}

Expand Down
10 changes: 7 additions & 3 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
)

var (
syncCmdParallelism int
syncCmdDBUpdateDelay int
syncWorkspace string
syncCmdParallelism int
syncCmdDBUpdateDelay int
syncCmdDBWSUpdateDelay int
syncWorkspace string
)

// newSyncCmd represents the sync command
Expand Down Expand Up @@ -58,6 +59,9 @@ to get Kong's state in sync with the input state.`,
0, "artificial delay (in seconds) that is injected between insert operations \n"+
"for related entities (usually for Cassandra deployments).\n"+
"See `db_update_propagation` in kong.conf.")
syncCmd.Flags().IntVar(&syncCmdDBWSUpdateDelay, "db-workspace-update-propagation-delay",
0, "artificial delay (in seconds) that is injected between new workspaces creation \n"+
"and all the remaining operations.")
syncCmd.Flags().BoolVar(&dumpConfig.SkipCACerts, "skip-ca-certificates",
false, "do not sync CA certificates.")
addSilenceEventsFlag(syncCmd.Flags())
Expand Down