@@ -178,7 +178,7 @@ func (p *Plugin) ObjectStack(data interface{}) (stack map[string]interface{}) {
178178 return
179179 }
180180
181- timeout := acquireTimeout (ODC_CONFIGURE_TIMEOUT , varStack , "Configure" , envId )
181+ timeout := callable . AcquireTimeout (ODC_CONFIGURE_TIMEOUT , varStack , "Configure" , envId )
182182
183183 arguments := make (map [string ]string )
184184 arguments ["environment_id" ] = envId
@@ -212,7 +212,7 @@ func (p *Plugin) ObjectStack(data interface{}) (stack map[string]interface{}) {
212212 Warn ("cannot acquire run number for ODC" )
213213 }
214214
215- timeout := acquireTimeout (ODC_START_TIMEOUT , varStack , "Start" , envId )
215+ timeout := callable . AcquireTimeout (ODC_START_TIMEOUT , varStack , "Start" , envId )
216216
217217 arguments := make (map [string ]string )
218218 arguments ["run_number" ] = rn
@@ -234,7 +234,7 @@ func (p *Plugin) ObjectStack(data interface{}) (stack map[string]interface{}) {
234234 return
235235 }
236236 stack ["Stop" ] = func () (out string ) {
237- timeout := acquireTimeout (ODC_STOP_TIMEOUT , varStack , "Stop" , envId )
237+ timeout := callable . AcquireTimeout (ODC_STOP_TIMEOUT , varStack , "Stop" , envId )
238238
239239 ctx , cancel := context .WithTimeout (context .Background (), timeout )
240240 defer cancel ()
@@ -252,7 +252,7 @@ func (p *Plugin) ObjectStack(data interface{}) (stack map[string]interface{}) {
252252 return
253253 }
254254 stack ["Reset" ] = func () (out string ) {
255- timeout := acquireTimeout (ODC_RESET_TIMEOUT , varStack , "Reset" , envId )
255+ timeout := callable . AcquireTimeout (ODC_RESET_TIMEOUT , varStack , "Reset" , envId )
256256
257257 ctx , cancel := context .WithTimeout (context .Background (), timeout )
258258 defer cancel ()
@@ -270,7 +270,7 @@ func (p *Plugin) ObjectStack(data interface{}) (stack map[string]interface{}) {
270270 return
271271 }
272272 stack ["EnsureCleanup" ] = func () (out string ) {
273- timeout := acquireTimeout (ODC_GENERAL_OP_TIMEOUT , varStack , "EnsureCleanup" , envId )
273+ timeout := callable . AcquireTimeout (ODC_GENERAL_OP_TIMEOUT , varStack , "EnsureCleanup" , envId )
274274
275275 ctx , cancel := context .WithTimeout (context .Background (), timeout )
276276 defer cancel ()
@@ -295,26 +295,3 @@ func (p *Plugin) ObjectStack(data interface{}) (stack map[string]interface{}) {
295295func (p * Plugin ) Destroy () error {
296296 return p .odcClient .Close ()
297297}
298-
299- func acquireTimeout (defaultTimeout time.Duration , varStack map [string ]string , callName string , envId string ) time.Duration {
300- timeout := defaultTimeout
301- timeoutStr , ok := varStack ["__call_timeout" ] // the Call interface ensures we'll find this key
302- // see Call.Call in callable/call.go for details
303- if ok {
304- var err error
305- timeout , err = time .ParseDuration (timeoutStr )
306- if err != nil {
307- timeout = defaultTimeout
308- log .WithField ("partition" , envId ).
309- WithField ("call" , callName ).
310- WithField ("default" , timeout .String ()).
311- Warn ("could not parse timeout declaration for hook call" )
312- }
313- } else {
314- log .WithField ("partition" , envId ).
315- WithField ("call" , callName ).
316- WithField ("default" , timeout .String ()).
317- Warn ("could not get timeout declaration for hook call" )
318- }
319- return timeout
320- }
0 commit comments