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 /src/git.rs | |
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 'src/git.rs')
0 files changed, 0 insertions, 0 deletions