release/v5.0 ← tweak/gravity_performance
opened 03:48PM - 24 Jan 20 UTC
**By submitting this pull request, I confirm the following:**
- [X] I have r…ead and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template.
- [X] I have made only one major change in my proposed changes.
- [X] I have commented my proposed changes within the code.
- [X] I have tested my proposed changes, and have included unit tests where possible.
- [X] I am willing to help maintain this change if there are issues with it later.
- [X] I give this submission freely and claim no ownership.
- [X] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1)
- [X] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
---
**What does this PR aim to accomplish?:**
Improve gravity performance. There is an extensive discussion about this in on [Discourse](https://discourse.pi-hole.net/t/pihole-g-list-download-disappointing-performance/27266).
**IMPORTANT:** *Please review + merge #3089 first*
**How does this PR accomplish the above?:**
Rewrote most of the gravity code which in concerned with the database. Create a second database during the download process, inject all domains there and swap this new with the old database. This has the additional benefit that there is no time in which the database is unavailable to FTL.
**What documentation changes (if any) are needed to support this PR?:**
Needs to be checked.