The existing console logger was broken when populating multiple indexes with a single command execution, as the listeners for the older progress bars were still being called. This caused the progress bar to behave quite interestingly, by not showing the actual progress for any index being populated after the first one.
This PR replaces the old callable by a stateful class, which can be marked as finished when the process is done. By finishing, the progress bar is finished in the output, a new line is written and further calls (from the still bound event handler) are being ignored. To further clean the populate process, the old event listeners are being removed now as well.
Why not keep the static function only and remove the event listeners? I needed something that was capable of closing the progress bar cleanly, and I believe this class is the best solution for this.
The existing console logger was broken when populating multiple indexes with a single command execution, as the listeners for the older progress bars were still being called. This caused the progress bar to behave quite interestingly, by not showing the actual progress for any index being populated after the first one.
This PR replaces the old callable by a stateful class, which can be marked as finished when the process is done. By finishing, the progress bar is finished in the output, a new line is written and further calls (from the still bound event handler) are being ignored. To further clean the populate process, the old event listeners are being removed now as well.
Why not keep the static function only and remove the event listeners? I needed something that was capable of closing the progress bar cleanly, and I believe this class is the best solution for this.
Old output
https://user-images.githubusercontent.com/1835343/202021907-6af4f44b-542c-4126-91b2-4cbbfb66ef89.mp4
New output
https://user-images.githubusercontent.com/1835343/202022563-561b2bfe-749f-487a-8b33-cf9af9d5863e.mp4