pieceofsummer / Hangfire.Console

Job console extension for Hangfire
MIT License
436 stars 80 forks source link

Debounce progress bar updates #100

Open sh1n1g4m1 opened 4 years ago

sh1n1g4m1 commented 4 years ago

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

lukevp commented 4 years ago

@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..

pieceofsummer commented 3 years ago

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.