Use a timer to refresh UI seems not working as attended


When I first used UserInbox add-on, I noticed that despite having a Timer every 3 second to update the message badge, it was not refreshing.

Later I found that the badge was refreshing sometimes but after a very long time.

So I made the attached test project with user-inbox add-on + a test timer that displays a notification each time it is called.

I found out that the test timer is working as intended, displaying a notification every 3 sec. But I do not understand why the timer updating messages badge does not.

I had the same issue when using a timer in our project to update graphs on a screen, it works twice then it stops to work.

Michael (78.8 KB)


Pay attention to initUpdateCounterTimerDelay() method.

private void initUpdateCounterTimerDelay() {
    int period = webConfig.getAppFoldersRefreshPeriodSec() * 1000;

Folders refresh period is 180 seconds by default, so as result you set delay with 180 000 mls.

Which is 3 minutes, oh my bad. Good old rule : don’t copy paste without reading what you paste. Thanks Roman !

1 Like