Skip to content

Commit

Permalink
Merge pull request #746 from ystia/bugfix/GH-745_Over_consumption_of_…
Browse files Browse the repository at this point in the history
…Consul_connections

Fix Consul connections over consumtion on task monitoring
  • Loading branch information
loicalbertin committed Jun 11, 2021
2 parents e8759d1 + c34b529 commit a0fa2e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### BUG FIXES

* Over-consumption of Consul connections ([GH-745](https://github.com/ystia/yorc/issues/745))
* Yorc panics attempting to print an error handling a script execution stdout ([GH-741](https://github.com/ystia/yorc/issues/741))
* Error submitting a SLURM job with no execution option ([GH-739](https://github.com/ystia/yorc/issues/739))
* Workflow with asynchronous action never stops after another step failure ([GH-733](https://github.com/ystia/yorc/issues/733))
Expand Down
12 changes: 4 additions & 8 deletions tasks/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,15 +625,11 @@ func MonitorTaskFailure(ctx context.Context, taskID string, f func()) {
func monitorTaskFlag(ctx context.Context, taskID, flag string, value []byte, f func()) {
go func() {
var lastIndex uint64
queryMeta := &api.QueryOptions{}
queryMeta = queryMeta.WithContext(ctx)
for {
select {
case <-ctx.Done():
log.Debugf("Task monitoring for flag %s exit", flag)
return
default:
}

kvp, qMeta, err := consulutil.GetKV().Get(path.Join(consulutil.TasksPrefix, taskID, flag), &api.QueryOptions{WaitIndex: lastIndex})
queryMeta.WaitIndex = lastIndex
kvp, qMeta, err := consulutil.GetKV().Get(path.Join(consulutil.TasksPrefix, taskID, flag), queryMeta)

select {
case <-ctx.Done():
Expand Down

0 comments on commit a0fa2e2

Please sign in to comment.