Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Add flag to customize the interval which the onStatus hook is called
Browse files Browse the repository at this point in the history
  • Loading branch information
tknodell-recurly authored and dm-2 committed Feb 7, 2022
1 parent d8ccc11 commit 0a87c7a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions go/base/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ type MigrationContext struct {
HooksHintMessage string
HooksHintOwner string
HooksHintToken string
HooksStatusIntervalSec int64

DropServeSocket bool
ServeSocketFile string
Expand Down
1 change: 1 addition & 0 deletions go/cmd/gh-ost/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func main() {
flag.StringVar(&migrationContext.HooksHintMessage, "hooks-hint", "", "arbitrary message to be injected to hooks via GH_OST_HOOKS_HINT, for your convenience")
flag.StringVar(&migrationContext.HooksHintOwner, "hooks-hint-owner", "", "arbitrary name of owner to be injected to hooks via GH_OST_HOOKS_HINT_OWNER, for your convenience")
flag.StringVar(&migrationContext.HooksHintToken, "hooks-hint-token", "", "arbitrary token to be injected to hooks via GH_OST_HOOKS_HINT_TOKEN, for your convenience")
flag.Int64Var(&migrationContext.HooksStatusIntervalSec, "hooks-status-interval", 60, "how many seconds to wait between calling onStatus hook")

flag.UintVar(&migrationContext.ReplicaServerId, "replica-server-id", 99999, "server id used by gh-ost process. Default: 99999")

Expand Down
2 changes: 1 addition & 1 deletion go/logic/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
w := io.MultiWriter(writers...)
fmt.Fprintln(w, status)

if elapsedSeconds%60 == 0 {
if elapsedSeconds%this.migrationContext.HooksStatusIntervalSec == 0 {
this.hooksExecutor.onStatus(status)
}
}
Expand Down

0 comments on commit 0a87c7a

Please sign in to comment.