[database] Fix issue with server time offset #910
This commit is contained in:
parent
9f9a3da5af
commit
804ef772c0
@ -52,6 +52,7 @@ export default class Database extends ModuleBase {
|
|||||||
serviceUrl
|
serviceUrl
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this._serverTimeOffset = 0;
|
||||||
this._serviceUrl = serviceUrl;
|
this._serviceUrl = serviceUrl;
|
||||||
this._transactionHandler = new TransactionHandler(this);
|
this._transactionHandler = new TransactionHandler(this);
|
||||||
|
|
||||||
@ -64,7 +65,6 @@ export default class Database extends ModuleBase {
|
|||||||
// todo move this and persistence to native side, create a db configure() method natively perhaps?
|
// todo move this and persistence to native side, create a db configure() method natively perhaps?
|
||||||
// todo and then native can call setPersistence and then emit offset events
|
// todo and then native can call setPersistence and then emit offset events
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this._serverTimeOffset = 0;
|
|
||||||
this._offsetRef = this.ref('.info/serverTimeOffset');
|
this._offsetRef = this.ref('.info/serverTimeOffset');
|
||||||
this._offsetRef.on('value', snapshot => {
|
this._offsetRef.on('value', snapshot => {
|
||||||
this._serverTimeOffset = snapshot.val() || this._serverTimeOffset;
|
this._serverTimeOffset = snapshot.val() || this._serverTimeOffset;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user