Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
7eb68b7e
Commit
7eb68b7e
authored
3 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Fix race condition when closing channels. Don't retry anymore and instead prefer erroring out
parent
6fe18101
No related branches found
No related tags found
3 merge requests
!231
Revert "Update store to print changes to the partners list"
,
!187
Xx 3829/triggers
,
!182
Add the restore error operation to the report object
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xxmutils/restoreContacts.go
+9
-6
9 additions, 6 deletions
xxmutils/restoreContacts.go
with
9 additions
and
6 deletions
xxmutils/restoreContacts.go
+
9
−
6
View file @
7eb68b7e
...
@@ -149,13 +149,18 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, client *api.Client,
...
@@ -149,13 +149,18 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, client *api.Client,
}
}
// Cleanup
// Cleanup
// lookupCh -> foundCh -> resetContactCh -> restoredCh
close
(
lookupCh
)
close
(
lookupCh
)
close
(
resetContactCh
)
close
(
failCh
)
// Now wait for subroutines to close before closing their output chans
// Now wait for subroutines to close before closing their output chans
lcWg
.
Wait
()
lcWg
.
Wait
()
// Close input to reset chan after lookup is done to avoid writes after
// close
close
(
foundCh
)
close
(
foundCh
)
close
(
resetContactCh
)
rsWg
.
Wait
()
rsWg
.
Wait
()
// failCh is closed after exit of the threads to avoid writes after
// close
close
(
failCh
)
close
(
restoredCh
)
close
(
restoredCh
)
failWg
.
Wait
()
failWg
.
Wait
()
...
@@ -185,8 +190,6 @@ func LookupContacts(in chan *id.ID, out chan *contact.Contact,
...
@@ -185,8 +190,6 @@ func LookupContacts(in chan *id.ID, out chan *contact.Contact,
continue
continue
}
}
jww
.
WARN
.
Printf
(
"could not lookup %s: %v"
,
lookupID
,
err
)
jww
.
WARN
.
Printf
(
"could not lookup %s: %v"
,
lookupID
,
err
)
// Retry later
in
<-
lookupID
}
}
}
}
...
@@ -207,9 +210,9 @@ func ResetSessions(in, out chan *contact.Contact, failCh chan failure,
...
@@ -207,9 +210,9 @@ func ResetSessions(in, out chan *contact.Contact, failCh chan failure,
continue
continue
}
}
// If an error, figure out if I should report or retry
// If an error, figure out if I should report or retry
// Note: Always
retry
here for now.
// Note: Always
fail
here for now.
jww
.
WARN
.
Printf
(
"could not reset %s: %v"
,
c
.
ID
,
err
)
jww
.
WARN
.
Printf
(
"could not reset %s: %v"
,
c
.
ID
,
err
)
in
<-
c
failCh
<-
failure
{
ID
:
c
.
ID
,
Err
:
err
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment