Details
-
Bug
-
Status: Closed
-
Should
-
Resolution: Fixed
-
Platform 1.9.9, Platform 1.10.2, Platform 1.11.4
-
None
Description
It is due to a call to isAuthenticated, which calls getAuthenticatedUser. When running in a Daemon thread the user is not being cached in the UserContext rather queried from the DB by UUID every time any service method is called, which is slow. See https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/context/Context.java#L610
isAuthenticated should simply return true, if isDaemonThread returns true.
Another way to fix it, would be storing the Deamon user in UserContext, but maybe there was some reasoning behind not doing so at the first place. dkayiwa, wyclif, djazayeri, do you have any insights?