Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-21230

Repositories are not sync during adding a new organisation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 9.1.0, 8.20.11
    • 8.16.1, 8.20.0
    • DVCS Connector
    • None

    Description

      Issue Summary

      Repositories are not sync after adding a new organisation during DvcsScheduledJob.syncOrganizations().

      Steps to Reproduce

      1. Add a new organisation while DvcsScheduledJob.syncOrganizations() is running, for example add Thread.sleep() in this method RepositorySyncServiceImpl.syncReposWithUpdates() and while the thread is sleeping we have to add another organisation. In this case adding will be interrupted in RepositorySyncServiceImpl.syncRepositoryList() because of clusterLockService.getLockForName(SYNC_REPOSITORY_LIST_LOCK).

      Expected Results

      The sync works for all repos for all organisations. 

      Actual Results

      Repositories for an organisation weren't added.

      Workaround

      Customer can change lastPolled for past date for example the beginning of 1970s. In column  LAST_POLLED in  AO_E8B6CC_ORGANIZATION_MAPPING  table. After this sync of the organisation will be performed during next scheduled job.

      Technical explanation:

      When we add a new organization we create it and save into db in AddGithubOrganization.doAddOrganization() then we start RepositorySyncServiceImpl.syncRepositoryList() and in this method we stop because of the Lock. The organization was created but we didn't get any repositories. At the next scheduledJob we will iterate through organizations, get and synchronize repos with GithubCommunicator.getRepositoriesWithUpdates  * and the problem is, that in the end of it there is a method filterRepositoriesWithUpdates()  which iterates through repositories and check if pushed date of repo is after the date when organization was synchronized last time (field lastPolled into Organisation.class{*}) if yes this repo will be added to the list. And here is the issue, because when we created the organization we setted lastPolled date by default into DB and it always will be after the pushed date of all repos of this organization so we wouldn't get any repositories. 

      Attachments

        Issue Links

          Activity

            People

              1c017edd2c81 awojtasik
              4d7ea414c7a1 Dmytro Kushniruk (Inactive)
              Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: