Skip to content
Snippets Groups Projects
Commit 85f2f540 authored by OZGCloud's avatar OZGCloud
Browse files

Revert "Add parameter for performing user sync on start up."

This reverts commit 34bf63d7.
parent 8c117331
Branches
Tags
No related merge requests found
......@@ -25,14 +25,10 @@ package de.ozgcloud.user.sync;
import static io.quarkus.scheduler.Scheduled.ConcurrentExecution.*;
import de.ozgcloud.user.common.lock.LockService;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import de.ozgcloud.user.common.lock.LockService;
import io.quarkus.runtime.StartupEvent;
import io.quarkus.scheduler.Scheduled;
import lombok.extern.log4j.Log4j2;
......@@ -45,15 +41,6 @@ public class SyncScheduler {
@Inject
LockService syncLockService;
@ConfigProperty(name = "ozgcloud.usersync.onstart")
boolean syncUsers;
void onStart(@Observes StartupEvent event) {
if (syncUsers) {
start();
}
}
@Scheduled(every = "{ozgcloud.usersync.period}", concurrentExecution = SKIP)
public void start() {
if (syncLockService.isNotLocked()) {
......
......@@ -47,4 +47,3 @@ ozgcloud:
client: alfa
usersync:
period: "6h"
\ No newline at end of file
onstart: false
\ No newline at end of file
......@@ -38,7 +38,6 @@ import org.mockito.Spy;
import de.ozgcloud.user.common.lock.Lock;
import de.ozgcloud.user.common.lock.LockService;
import io.quarkus.runtime.StartupEvent;
class SyncSchedulerTest {
......@@ -125,31 +124,4 @@ class SyncSchedulerTest {
verify(syncLockService).unlock();
}
}
@Nested
class OnStartTest {
@Test
void shouldSyncUsers() {
doNothing().when(scheduler).start();
scheduler.syncUsers = true;
callScheduler();
verify(scheduler).start();
}
@Test
void shouldNOTSyncUsers() {
scheduler.syncUsers = false;
callScheduler();
verify(scheduler, never()).start();
}
private void callScheduler() {
scheduler.onStart(new StartupEvent());
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment