only call sync_apply if no wallet found
This commit is contained in:
parent
9d4f7dc642
commit
d8aecaeb29
1 changed files with 11 additions and 8 deletions
|
@ -9,6 +9,7 @@ import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||||
|
|
||||||
let syncTimer = null;
|
let syncTimer = null;
|
||||||
const SYNC_INTERVAL = 1000 * 60 * 5; // 5 minutes
|
const SYNC_INTERVAL = 1000 * 60 * 5; // 5 minutes
|
||||||
|
const NO_WALLET_ERROR = 'no wallet found for this user';
|
||||||
|
|
||||||
export function doSetDefaultAccount(success, failure) {
|
export function doSetDefaultAccount(success, failure) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
|
@ -231,14 +232,16 @@ export function doGetSync(passedPassword, callback) {
|
||||||
|
|
||||||
// call sync_apply to get data to sync
|
// call sync_apply to get data to sync
|
||||||
// first time sync. use any string for old hash
|
// first time sync. use any string for old hash
|
||||||
Lbry.sync_apply({ password })
|
if (syncAttemptError.message === NO_WALLET_ERROR) {
|
||||||
.then(({ hash: walletHash, data: syncApplyData }) => {
|
Lbry.sync_apply({ password })
|
||||||
dispatch(doSetSync('', walletHash, syncApplyData, password));
|
.then(({ hash: walletHash, data: syncApplyData }) => {
|
||||||
handleCallback();
|
dispatch(doSetSync('', walletHash, syncApplyData, password));
|
||||||
})
|
handleCallback();
|
||||||
.catch(syncApplyError => {
|
})
|
||||||
handleCallback(syncApplyError);
|
.catch(syncApplyError => {
|
||||||
});
|
handleCallback(syncApplyError);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue