Skip to content

Commit 905df7e

Browse files
committed
zombierecovery: make amboss delay configurable
1 parent 3503b21 commit 905df7e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmd/chantools/zombierecovery_findmatches.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222
"(?m)(?s)ID: ([0-9a-f]{66})\nContact: (.*?)\nTime: ",
2323
)
2424

25-
ambossQueryDelay = 4 * time.Second
25+
defaultAmbossQueryDelay = 4 * time.Second
2626

2727
initialTemplate = `SEND TO: {{.Contact}}
2828
@@ -116,6 +116,7 @@ type zombieRecoveryFindMatchesCommand struct {
116116
APIURL string
117117
Registrations string
118118
AmbossKey string
119+
AmbossDelay time.Duration
119120

120121
cmd *cobra.Command
121122
}
@@ -150,6 +151,10 @@ registered nodes.`,
150151
&cc.AmbossKey, "ambosskey", "", "the API key for the Amboss "+
151152
"GraphQL API",
152153
)
154+
cc.cmd.Flags().DurationVar(
155+
&cc.AmbossDelay, "ambossdelay", defaultAmbossQueryDelay,
156+
"the delay between each query to the Amboss GraphQL API",
157+
)
153158

154159
return cc.cmd
155160
}
@@ -194,7 +199,7 @@ func (c *zombieRecoveryFindMatchesCommand) Execute(_ *cobra.Command,
194199
for node1, contact1 := range registrations {
195200
matches[node1] = make(map[string]*match)
196201

197-
time.Sleep(ambossQueryDelay)
202+
time.Sleep(c.AmbossDelay)
198203
log.Debugf("Fetching channels for node %d of %d", idx,
199204
len(registrations))
200205
idx++

0 commit comments

Comments
 (0)