Skip to content

Commit

Permalink
Sync tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Nov 8, 2024
1 parent 8de0899 commit 3bf7d3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions bin/servers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ let ui () =
Lwd_seq.map (fun (_, server) -> ui_status server) servers_with_status
in
let ui_form =
(* FIXME: user can validate multiple times *)
Lwd.map servers_with_status ~f:(fun s ->
match Lwd_seq.view s with
| Empty -> Lwd_seq.element @@ Elwd.div [ `R (ui_form ()) ]
Expand Down
5 changes: 3 additions & 2 deletions lib/db/sync.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ open Source.Api
prefixed by one of the view's virtual folder locations.
*)

let chunk_size = 2000
let chunk_size = 500

let include_item_types =
[ Source.Api.Item.MusicArtist; MusicAlbum; Audio; MusicGenre; Genre ]
Expand Down Expand Up @@ -353,7 +353,7 @@ let sync ?(report = fun _ -> ()) ~(source : Source.connexion) idb =
in
enqueue ~start_index:first total;
let total_queries = Queue.length fetch_queue in
let rec run_queue ?(threads = 2) q =
let rec run_queue ?(threads = 4) q =
assert (threads > 0);
let rec take_n acc n =
if n = 0 then List.rev acc
Expand All @@ -367,6 +367,7 @@ let sync ?(report = fun _ -> ()) ~(source : Source.connexion) idb =
We could send the next request while handling the previous results.
This should speed up the process a lot. (Also there might be
opportunities to speed up result handling.) *)
(* TODO: there's a stack overflow somewhere...*)
let f req =
let+ { Api.Items.start_index; items; _ } =
query source (module Api.Items) req ()
Expand Down

0 comments on commit 3bf7d3c

Please sign in to comment.