diff options
author | Teddy Wing | 2021-06-12 21:00:48 +0200 |
---|---|---|
committer | Teddy Wing | 2021-06-12 21:00:48 +0200 |
commit | e4a41075af126dbcac19fe91267f785b3b391ee0 (patch) | |
tree | 52d2a4a0a6f60ff386396d056625611824aa4e90 /Cargo.toml | |
parent | 46497bbae37f89e449b7a049663fe774843beb9b (diff) | |
download | reflectub-e4a41075af126dbcac19fe91267f785b3b391ee0.tar.bz2 |
Process repositories on multiple threads
Use 'rayon' to parallelise the repository processing. Each repository is
processed in a thread in the default 'rayon' pool.
In order to get thread-safe access to the database, I followed some
advice from a Stack Overflow answer by VasiliNovikov
(https://stackoverflow.com/users/1091436/vasilinovikov):
https://stackoverflow.com/questions/62560396/how-to-use-sqlite-via-rusqlite-from-multiple-threads/62560397#62560397
VasiliNovikov recommended creating a database connection pool using
'r2d2_sqlite'. This way we don't have to share a database connection
between threads, but each thread can have its own connection.
This also means we can remove mutable requirements in a bunch of places
involving our `database::Db` type since we're no longer managing the
database connections directly.
Diffstat (limited to 'Cargo.toml')
-rw-r--r-- | Cargo.toml | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -11,6 +11,9 @@ filetime = "0.2.14" getopts = "0.2.21" git2 = "0.13.20" parse-size = { version = "1.0.0", features = ["std"] } +r2d2 = "0.8.9" +r2d2_sqlite = "0.18.0" +rayon = "1.5.1" rusqlite = "0.25.3" serde = { version = "1.0.126", features = ["derive"] } thiserror = "1.0.25" |