Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4771

Authorization checks are slow when running as Daemon

    XMLWordPrintable

Details

    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?

      Gliffy Diagrams

        Attachments

          Activity

            People

              raff Rafal Korytkowski
              raff Rafal Korytkowski
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: