Skip to content

Commit ebd5645

Browse files
authored
Merge pull request #1083 from tknodell-recurly/customize_status_hook_interval
Add flag to customize the interval which the onStatus hook is called
2 parents dc9a2e3 + 94ffadf commit ebd5645

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
@@ -140,6 +140,7 @@ type MigrationContext struct {
140140
HooksHintMessage string
141141
HooksHintOwner string
142142
HooksHintToken string
143+
HooksStatusIntervalSec int64
143144

144145
DropServeSocket bool
145146
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)