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

Sync db autosaves #10212

Merged
merged 1 commit into from
Dec 7, 2018
Merged

Sync db autosaves #10212

merged 1 commit into from
Dec 7, 2018

Conversation

Moocar
Copy link
Contributor

@Moocar Moocar commented Nov 29, 2018

This PR orchestrates the saving of db state for both loki and redux into one place. Previously, loki would use its autosave feature and save to disk every 1000ms. Whereas now, it uses the same style as gatsby/redux where a debounced save is triggered for each new event.

Note that both database save asynchronously (redux's write to disk is async) so this isn't a perfect "Stop the world" synchronized save. However it's better than it was before.

Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

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

One of @pieh and I will take a look at this in more depth, but first glance, probably a good idea to resolve the mismatched history here, since I think only the last, or last few, commits are relevant!

(It won't really matter because we'll squash anyways, but probably still worth doing!)

@pieh pieh self-assigned this Dec 1, 2018
@Moocar
Copy link
Contributor Author

Moocar commented Dec 4, 2018

@DSchau Wow, that was some messed up history. I went for the nuclear option since it's not much code. Should be good to review now.

@pieh
Copy link
Contributor

pieh commented Dec 7, 2018

Note that both database save asynchronously (redux's write to disk is async) so this isn't a perfect "Stop the world" synchronized save. However it's better than it was before.

Yeah, let's get this in - later on we can do some save queue instead of debouncing or something like that, so we create task that will wait for all "partial" state saves before resolving. But this is good for now - small incremental changes are much nicer to review and reason with

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

Thanks @Moocar 🙏

@pieh pieh merged commit 1c0d051 into gatsbyjs:master Dec 7, 2018
m-allanson added a commit that referenced this pull request Dec 8, 2018
* master: (1421 commits)
  feat(gatsby-image): add onStartLoad prop  (#6702)
  fix(docs): add Ecosystem to docs sidebar, consistency with tutorial sidebar (#10350)
  fix(www): Starters.yaml housekeeping (#10354)
  docs: add ttag starter (#10352)
  docs: document branching (#9983)
  plugin checker initial commit (#7062)
  docs: new starter features is required (#10353)
  docs: migrated line highlighting to highlight-line, highlight-start, highlight-end (#10202)
  Add Birra Napoli to site showcase (#10344)
  Add BetterDocs to site showcase (#10349)
  chore(release): Publish
  Add option to keep metadata in files processed by `gatsby-plugin-sharp` (#10210)
  fix(gatsby): [loki] sync db autosaves (#10212)
  Add Ad Hoc Homework to sites.yml (#10346)
  fix(graphql-skip-limit): declare `graphql` peer dependency (#10305)
  fix(gatsby-plugin-offline): gracefully degrade if appshell isn't precached (#10329)
  Service workers note (#10276)
  fix(docs): link fixes, podcast addition (#10332)
  feat(docs): Create clearer pathways in docs (#9898)
  feat(www): Rename community section to creators (#10312)
  ...
gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
This PR orchestrates the saving of db state for both loki and redux into one place. Previously, loki would use its `autosave` feature and save to disk every 1000ms. Whereas now, it uses the same style as `gatsby/redux` where a debounced save is triggered for each new event. 

Note that both database save asynchronously (redux's write to disk is async) so this isn't a perfect "Stop the world" synchronized save. However it's better than it was before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants