G_003_R3 Update hangs because of unstable angular app
Background
The update modal that informs users of a new version isn't getting triggered when you open the application.
After some initial research is was found that Angular has "macro tasks" that relate to the process of injection. Angular instantiates each constructor of the classes that need to be created. When all initialization processes (macro tasks) are finished, the app gets into the stable state. However, there are a set of functions that are not recommended to be used inside the constructor because they will make that the init tasks of Angular cannot be finished.
The initialize method tries to check if the app is stable before actually setting up the timer that is responsible for the update checks. This check doesn't get completed in due time to check for updates.
After removing this module from initializing, the promise is completed with true, which allows the update check to get triggered.
That is to say that something in the initialization of RccUsageLoggingService is causing the great delay in the promise completion. Either in the constructor itself or in the injected parameters.
What to do
-
Identify which part of the module is the offending unit. Its constructor or the constructors of the other injected values in the parameter list. -
Find a way to apply the recommendations in the link above if the offending unit contains one of those function calls.
How to Test
Testing is a bit cumbersome but there is a way. Angular recognizes that there is new version when some file has changed (at least that is what I observed with my testing), that is to say that we need to "touch" a file in other for the version to be really different. However, I described a more convenient way to do it.
- Install Docker
- You need at least two docker images. One with an older version and the other with a new version.
- For you to better see when running the images, change this tag with the version you want. Optionally, you can also modify the describe field.
- Build a docker image for your first version and run it.
- Make your new changes of fixes.
- Build one more docker image for your second version.
- Stop the first running up in the command line.
- Run the second image.
- You can now play with the update module getting triggered on the new version.
Contact Carlos for further questions.