Hangfire.Console icon indicating copy to clipboard operation
Hangfire.Console copied to clipboard

Debounce progress bar updates

Open sh1n1g4m1 opened this issue 4 years ago • 2 comments

Change progress bar to only update on integer changes, this prevents excessive database writes.

sh1n1g4m1 avatar Aug 24 '20 16:08 sh1n1g4m1

@pieceofsummer we are using this in production with a forked build of this project, do you see any issues with this PR, or could we get this merged into upstream? It is a major performance improvement, we had a job that was iterating over a collection with millions of entries so it went from millions of db writes in the extension method to a hundred or fewer, no matter the collection size..

lukevp avatar Sep 17 '20 15:09 lukevp

I think there's a more elegant solution, by providing a configurable precision value used for rounding here: https://github.com/pieceofsummer/Hangfire.Console/blob/a1fea1356c46fe70b0a9df1785cf5c138aa18ae0/src/Hangfire.Console/Progress/DefaultProgressBar.cs#L38

So you don't need to track it manually elsewhere.

pieceofsummer avatar Nov 10 '20 20:11 pieceofsummer