Run downloading, unpacking, and saving in parallel for serialized syncs#5593
Run downloading, unpacking, and saving in parallel for serialized syncs#5593
Conversation
3b3d436 to
f4c74cc
Compare
| pure $ | ||
| Text.unlines | ||
| [ "", | ||
| " ⬇️ Downloaded: " <> tShow unpacked <> maybe "" (\total -> " / " <> tShow total) total <> Monoid.whenM doneUnpacking " 🏁", |
There was a problem hiding this comment.
Is this maybe for a future server feature, or how do I trigger it?
There was a problem hiding this comment.
There's a slot for the server to send the total if it knows what it is, but at the moment it doesn't ever send it because it would require enumerating the entire results set before starting the stream (and would slow everything down).
But if we ever support pre-computed release bundles then the server could provide the total here :)
|
@aryairani which terminal emulator do you use btw? Mine looks different, though agree that right-aligning would be nice (iterm2) 😓 |
huh, your terminal doesn't show a leading |
|
@aryairani ; Ahh, Looks like ⬇️ is Looks like iterm2 and terminal.app handle emoji codepoint width differently :'( E.g. putting terminal.app (don't mind the missing Nerdfont glyphs haha) Looks like the current wisdom on this is "Massive headache, avoid if possible" So I guess I gotta find a different emoji if we want things to line up 😓 |
Wow I'm surprised. Terminal.app has a setting "Unicode East Asian Ambiguous chararacters are wide" which is disabled by default, but it doesn't seem to do anything. It would be nice if it wasn't buggy. |
|
@aryairani Ugh, looks like it gets even worse; AFAICT the console region lib we're using counts chars so it can surgically update only the chars in the region which have changed, and AFAICT it counts emojis as one column even though most emulators render them as two, which explains the weird This is why we can't have nice things (a.k.a. emojis) |
|
Okay I've got it into some sort of reasonable output. I swear this progress bar is taking more time than the actual logic changed lol. The reason for the long pause before the progress bar was because it was waiting for the stream header before starting the progress bar, since we didn't know whether the total was included or the sorting type before the stream actually starts, but initializing the stream takes time on the server because it's a complex query. I refactored that a bit so the progress bar should start immediately (it'll still stay paused at 0 till things happen obviously) then will fill in the total and adjust to the stream type as needed. |
|
Alternatives to emojis, just regular characters: |
|
😞 |













Overview
Corresponding with unisoncomputing/share-api#41 ; this tweaks the download streams from a sorted source to split up downloading, unpacking, and validation/save into pipelines which run in parallel, this allows us to be saving to SQLite we're downloading things in parallel, rather than interleaving downloads with saving as we do on trunk at the moment.
Implementation notes
UnliftIO.Conc.Test coverage