Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.simprints.infra.config.store.ConfigRepository
import com.simprints.infra.config.store.models.ProjectConfiguration
import com.simprints.infra.events.EventRepository
import com.simprints.infra.events.event.domain.models.EventType
import com.simprints.infra.events.event.domain.models.scope.EventScopeEndCause
import com.simprints.infra.events.event.domain.models.scope.EventScopeType
import com.simprints.infra.eventsync.event.remote.EventRemoteDataSource
import com.simprints.infra.eventsync.status.down.EventDownSyncScopeRepository
Expand Down Expand Up @@ -101,6 +102,7 @@ internal class EventSyncManagerImpl @Inject constructor(
),
)
downSyncTask.downSync(this, op, eventScope, configRepository.getProject()).toList()
eventRepository.closeEventScope(eventScope, EventScopeEndCause.WORKFLOW_ENDED)
}

private fun getProjectModes(projectConfiguration: ProjectConfiguration) = projectConfiguration.general.modalities.map { it.toMode() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class EventSyncMasterWorker @AssistedInject internal constructor(
}

if (configuration.isEventDownSyncAllowed()) {
// TODO: Remove after all users have updated to 2025.3.0
// In versions before 2025.3.0 a bug prevented single subject down-sync scopes from being closed and uploaded.
// Attempting to close any such scopes and recover at least some of the data.
eventRepository.closeAllOpenScopes(EventScopeType.DOWN_SYNC, null)

eventRepository.createEventScope(
EventScopeType.DOWN_SYNC,
downSyncWorkerScopeId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ internal class EventSyncManagerTest {
eventSyncManagerImpl.downSyncSubject(DEFAULT_PROJECT_ID, "subjectId")

coVerify { downSyncTask.downSync(any(), any(), eventScope, any()) }
coVerify { eventRepository.closeEventScope(eventScope, any()) }
}

@Test
Expand Down