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

Force full contact/group import on next launch (if not first run) #1476

Merged
merged 2 commits into from Sep 14, 2017

Conversation

scottnonnenberg
Copy link
Contributor

As recommended in #1444, this is a one-time contact/group sync on startup. If you're not in the process of registering, of course.

@liliakai
Copy link
Contributor

In the past i've used migrations to schedule one-off jobs like this.

@liliakai
Copy link
Contributor

Alternatively, if this is only for chrome, you might consider putting it in the onInstalled listener in chromium.js, wherein you can inspect the previous version number and decide whether an import is needed.

js/background.js Outdated
// disable this checking if a user is first registering.
var key = 'chrome-contact-sync-v0.43.4';
if (firstRun) {
storage.put(key, true);
Copy link
Contributor

@liliakai liliakai Sep 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will re-write 'true' every time we re-register. Slightly better for perf if we drop this and add a && !firstRun to L#156.

Also, I'm not sure if this was the intent but, I note that:

  1. this code (the init function) runs every time we reconnect to the internet after being offline for a while.
  2. firstRun will be true on a re-registration, not just a first-registration.

@scottnonnenberg
Copy link
Contributor Author

I don't see any other prior examples of this kind of thing in the migrations. We can't expect that we're connected to the socket anyway when those things are run, right?

Yes, I suppose this is unique to Chrome. If we did the version check, would that still apply to users who skip the 0.43.3 -> 0.43.4 transition? Also, another place where we're not guaranteed to have a websocket open, anyway.

I do think this is the best place to do it. And I've made the change to write to storage only that first time through this codepath.

@scottnonnenberg scottnonnenberg merged commit ff6dc78 into master Sep 14, 2017
@scottnonnenberg scottnonnenberg deleted the forced-contact-sync branch September 14, 2017 19:08
scottnonnenberg added a commit that referenced this pull request Sep 14, 2017
Force full contact/group import on next launch if not first run (#1476)

Performance: Log entry max to 2k, less logging in hot codepaths (#1459)

Don't show notification for verified state change with yourself (#1454)

Export: Improve usability - timing expectations, install button (#1474)

Add Transifex config to git to unblock Electron localization (#1477)

Large localization update

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

Successfully merging this pull request may close these issues.

None yet

2 participants