Skip to content

Commit 0a87c7a

Browse files
tknodell-recurlydm-2
authored andcommitted
Add flag to customize the interval which the onStatus hook is called
1 parent d8ccc11 commit 0a87c7a

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

go/base/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ type MigrationContext struct {
141141
HooksHintMessage string
142142
HooksHintOwner string
143143
HooksHintToken string
144+
HooksStatusIntervalSec int64
144145

145146
DropServeSocket bool
146147
ServeSocketFile string

go/cmd/gh-ost/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func main() {
125125
flag.StringVar(&migrationContext.HooksHintMessage, "hooks-hint", "", "arbitrary message to be injected to hooks via GH_OST_HOOKS_HINT, for your convenience")
126126
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")
127127
flag.StringVar(&migrationContext.HooksHintToken, "hooks-hint-token", "", "arbitrary token to be injected to hooks via GH_OST_HOOKS_HINT_TOKEN, for your convenience")
128+
flag.Int64Var(&migrationContext.HooksStatusIntervalSec, "hooks-status-interval", 60, "how many seconds to wait between calling onStatus hook")
128129

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

go/logic/migrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
10161016
w := io.MultiWriter(writers...)
10171017
fmt.Fprintln(w, status)
10181018

1019-
if elapsedSeconds%60 == 0 {
1019+
if elapsedSeconds%this.migrationContext.HooksStatusIntervalSec == 0 {
10201020
this.hooksExecutor.onStatus(status)
10211021
}
10221022
}

0 commit comments

Comments
 (0)