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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
fd0ce8b5
Commit
fd0ce8b5
authored
Sep 29, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add more debugs
parent
3398652d
Branches
Branches containing commit
No related tags found
1 merge request
!399
Add initial debug prints
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
xxmutils/restoreContacts.go
+18
-1
18 additions, 1 deletion
xxmutils/restoreContacts.go
with
18 additions
and
1 deletion
xxmutils/restoreContacts.go
+
18
−
1
View file @
fd0ce8b5
...
@@ -41,6 +41,7 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, user *xxdk.E2e,
...
@@ -41,6 +41,7 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, user *xxdk.E2e,
udManager
*
ud
.
Manager
,
udManager
*
ud
.
Manager
,
updatesCb
interfaces
.
RestoreContactsUpdater
)
([]
*
id
.
ID
,
[]
*
id
.
ID
,
updatesCb
interfaces
.
RestoreContactsUpdater
)
([]
*
id
.
ID
,
[]
*
id
.
ID
,
[]
error
,
error
)
{
[]
error
,
error
)
{
jww
.
INFO
.
Printf
(
"RestoreContactsFromBackup(%s)"
,
backupPartnerIDs
)
var
restored
,
failed
[]
*
id
.
ID
var
restored
,
failed
[]
*
id
.
ID
var
errs
[]
error
var
errs
[]
error
...
@@ -52,6 +53,12 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, user *xxdk.E2e,
...
@@ -52,6 +53,12 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, user *xxdk.E2e,
update
:=
func
(
numFound
,
numRestored
,
total
int
,
err
string
)
{
update
:=
func
(
numFound
,
numRestored
,
total
int
,
err
string
)
{
if
updatesCb
!=
nil
{
if
updatesCb
!=
nil
{
jww
.
INFO
.
Printf
(
"Reporting restored contacts with:"
+
"
\n\t
Number found: %d"
+
"
\n\t
Number restored: %d"
+
"
\n\t
Total: %d"
+
"
\n\t
Error: %v
\n
"
,
numFound
,
numRestored
,
total
,
err
)
updatesCb
.
RestoreContactsCallback
(
numFound
,
numRestored
,
updatesCb
.
RestoreContactsCallback
(
numFound
,
numRestored
,
total
,
err
)
total
,
err
)
}
}
...
@@ -68,6 +75,12 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, user *xxdk.E2e,
...
@@ -68,6 +75,12 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, user *xxdk.E2e,
}
}
lookupIDs
,
resetContacts
,
restored
:=
checkRestoreState
(
idList
,
store
)
lookupIDs
,
resetContacts
,
restored
:=
checkRestoreState
(
idList
,
store
)
jww
.
INFO
.
Printf
(
"Check restore state results:"
+
"
\n\t
LookupIds: %v"
+
"
\n\t
Contacts: %v"
+
"
\n\t
Restored IDs: %v
\n
"
,
lookupIDs
,
resetContacts
,
restored
)
// State variables, how many we have looked up successfully
// State variables, how many we have looked up successfully
// and how many we have already reset.
// and how many we have already reset.
totalCnt
:=
len
(
idList
)
totalCnt
:=
len
(
idList
)
...
@@ -177,6 +190,7 @@ func LookupContacts(in chan *id.ID, out chan *contact.Contact,
...
@@ -177,6 +190,7 @@ func LookupContacts(in chan *id.ID, out chan *contact.Contact,
failCh
chan
failure
,
user
*
xxdk
.
E2e
,
udContact
contact
.
Contact
,
failCh
chan
failure
,
user
*
xxdk
.
E2e
,
udContact
contact
.
Contact
,
wg
*
sync
.
WaitGroup
)
{
wg
*
sync
.
WaitGroup
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
jww
.
INFO
.
Printf
(
"Looking up backed up contacts..."
)
// Start looking up contacts with user discovery and feed this
// Start looking up contacts with user discovery and feed this
// contacts channel.
// contacts channel.
for
lookupID
:=
range
in
{
for
lookupID
:=
range
in
{
...
@@ -191,7 +205,7 @@ func LookupContacts(in chan *id.ID, out chan *contact.Contact,
...
@@ -191,7 +205,7 @@ func LookupContacts(in chan *id.ID, out chan *contact.Contact,
failCh
<-
failure
{
ID
:
lookupID
,
Err
:
err
}
failCh
<-
failure
{
ID
:
lookupID
,
Err
:
err
}
continue
continue
}
}
jww
.
WARN
.
Printf
(
"
c
ould not lookup %s: %v"
,
lookupID
,
err
)
jww
.
WARN
.
Printf
(
"
C
ould not lookup %s: %v"
,
lookupID
,
err
)
}
}
}
}
...
@@ -204,6 +218,7 @@ func ResetSessions(in, out chan *contact.Contact, failCh chan failure,
...
@@ -204,6 +218,7 @@ func ResetSessions(in, out chan *contact.Contact, failCh chan failure,
user
*
xxdk
.
E2e
,
wg
*
sync
.
WaitGroup
)
{
user
*
xxdk
.
E2e
,
wg
*
sync
.
WaitGroup
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
for
c
:=
range
in
{
for
c
:=
range
in
{
jww
.
INFO
.
Printf
(
"Resetting contact with partner ID %s"
,
c
.
ID
)
_
,
err
:=
user
.
GetAuth
()
.
Reset
(
*
c
)
_
,
err
:=
user
.
GetAuth
()
.
Reset
(
*
c
)
if
err
==
nil
{
if
err
==
nil
{
out
<-
c
out
<-
c
...
@@ -222,6 +237,8 @@ func ResetSessions(in, out chan *contact.Contact, failCh chan failure,
...
@@ -222,6 +237,8 @@ func ResetSessions(in, out chan *contact.Contact, failCh chan failure,
// should be treated as internal functions specific to the phone apps.
// should be treated as internal functions specific to the phone apps.
func
LookupContact
(
userID
*
id
.
ID
,
user
*
xxdk
.
E2e
,
udContact
contact
.
Contact
)
(
func
LookupContact
(
userID
*
id
.
ID
,
user
*
xxdk
.
E2e
,
udContact
contact
.
Contact
)
(
*
contact
.
Contact
,
error
)
{
*
contact
.
Contact
,
error
)
{
jww
.
DEBUG
.
Printf
(
"Looking up contact with ID %s"
,
userID
)
// This is a little wonky, but wait until we get called then
// This is a little wonky, but wait until we get called then
// set the result to the contact objects details if there is
// set the result to the contact objects details if there is
// no error
// no error
...
...
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