Skip to content

Commit 615a357

Browse files
authored
fix: syncproxy module does not reload config file (#1606)
### Motivation An user reported that the `modules reload CloudNet-SyncProxy` command would reload the SyncProxy module but the module would not update the loaded configuration due to a wrongly placed `@Service` annotation. ### Modification Removed the wrong `@Service` annotation and the unnecessary null check. The management class is created by aerogel. If aerogel cannot find it / construct it, aerogel will throw an exception. ### Result The module configuration is properly reloaded on module reload. ##### Other context See https://discord.com/channels/325362837184577536/818777626663321671/1357362934732292187
1 parent 78e47f7 commit 615a357

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

modules/syncproxy/impl/src/main/java/eu/cloudnetservice/modules/syncproxy/impl/node/CloudNetSyncProxyModule.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import eu.cloudnetservice.driver.module.ModuleLifeCycle;
2424
import eu.cloudnetservice.driver.module.ModuleTask;
2525
import eu.cloudnetservice.driver.module.driver.DriverModule;
26-
import eu.cloudnetservice.driver.registry.Service;
2726
import eu.cloudnetservice.driver.service.ServiceEnvironmentType;
2827
import eu.cloudnetservice.modules.syncproxy.SyncProxyManagement;
2928
import eu.cloudnetservice.modules.syncproxy.config.SyncProxyConfiguration;
@@ -38,11 +37,14 @@
3837
import jakarta.inject.Singleton;
3938
import java.nio.file.Files;
4039
import lombok.NonNull;
41-
import org.jetbrains.annotations.Nullable;
40+
import org.slf4j.Logger;
41+
import org.slf4j.LoggerFactory;
4242

4343
@Singleton
4444
public final class CloudNetSyncProxyModule extends DriverModule {
4545

46+
private static final Logger LOGGER = LoggerFactory.getLogger(CloudNetSyncProxyModule.class);
47+
4648
@Inject
4749
public CloudNetSyncProxyModule(@NonNull @Named("module") InjectionLayer<?> layer) {
4850
layer.installAutoConfigureBindings(this.getClass().getClassLoader(), "syncproxy");
@@ -113,13 +115,12 @@ public void registerCommands(@NonNull CommandProvider commandProvider) {
113115
}
114116

115117
@ModuleTask(lifecycle = ModuleLifeCycle.RELOADING)
116-
public void handleReload(@Nullable @Service SyncProxyManagement management) {
117-
if (management != null) {
118-
management.configuration(this.loadConfiguration());
119-
}
118+
public void handleReload(@NonNull SyncProxyManagement management) {
119+
management.configuration(this.loadConfiguration());
120120
}
121121

122122
private @NonNull SyncProxyConfiguration loadConfiguration() {
123+
LOGGER.debug("Loading SyncProxy module configuration");
123124
return this.readConfig(
124125
SyncProxyConfiguration.class,
125126
() -> SyncProxyConfiguration.createDefault("Proxy"),

0 commit comments

Comments
 (0)