Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-sync message in console #24

Open
steph643 opened this issue Mar 19, 2015 · 8 comments
Open

Re-sync message in console #24

steph643 opened this issue Mar 19, 2015 · 8 comments
Labels

Comments

@steph643
Copy link

Each time my app uses the CPU intensively for a few seconds, I get the following message in the console:

Clock discrepancy detected. Attempting re-sync.

This brings me two questions:

  1. How does CPU activity relate to sync lost?
  2. My understanding was that TimeSync.watchClockChanges was false by default, preventing re-sync to occur. I tried to force it to false anyway, but it has no effect. How can I prevent re-sync?
@mizzao
Copy link
Collaborator

mizzao commented Apr 11, 2015

TimeSync uses a setInterval to check if there are unexpected differences in time each tick, such as the user waking their computer up from sleep, changing system time, etc.

https://github.com/mizzao/meteor-timesync/blob/master/timesync-client.js#L23

CPU busyness causes a setInterval to fire after longer than expected, which makes it look like there was an unexpected time change. I'm not sure if there is an easy way around this, but I'm all ears if you have suggestions.

If you don't like the log messages, you can set TimeSync.loggingEnabled = false, but there's no way to prevent re-syncing at the moment.

@steph643
Copy link
Author

Thanks for pointing me to loggingEnabled.

@crsssl
Copy link

crsssl commented Aug 27, 2015

Hi Andrew. Where do you think is the best place to put the TimeSync.loggingEnabled = false statement? Anywhere, or client Meteor.startup() ?

@mizzao
Copy link
Collaborator

mizzao commented Aug 27, 2015

It only logs on the client, but you can put it anywhere in a client folder, preferably in lib so it runs immediately. No Meteor.startup() needed.

@v3rron
Copy link

v3rron commented Oct 20, 2015

// client/init.js
Meteor.startup(function () {
  TimeSync.loggingEnabled = false;
});

Error: ReferenceError: Can't find variable: TimeSync

@mizzao
Copy link
Collaborator

mizzao commented Oct 20, 2015

meteor add mizzao:timesync to make it explicitly available in the top level of your app.

@BeSports
Copy link

but there's no way to prevent re-syncing at the moment.

Any updates on this? I'm using it for that chat part of my app, and just want to use the server time once (in my add-chat stub, to prevent jumping of chatlines).
And I'm just afraid that this will put extra strain on my server, no?

@mizzao
Copy link
Collaborator

mizzao commented Mar 14, 2016

No I don't think it materially puts extra strain on your server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants