Disable Graal-based Ydoc temporarily (#10627)

Graal Ydoc implementation is currently not being used locally or in the cloud and giving an impression of a slower startup.
Plus it appears that there some issues in the local connection as well.
To limit the impact of it now, let's make it controllable by the same env variable as GUI is.
This commit is contained in:
Hubert Plociniczak 2024-07-23 14:29:26 +02:00 committed by GitHub
parent 8af3fd42b9
commit aae8370977
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,6 +11,7 @@ public final class YdocInitialization extends LockedInitialization {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final ComponentSupervisor supervisor;
private final String ENABLED_YDOC = "POLYGLOT_YDOC_SERVER";
public YdocInitialization(Executor executor, ComponentSupervisor componentSupervisor) {
super(executor);
@ -19,19 +20,27 @@ public final class YdocInitialization extends LockedInitialization {
@Override
public void initComponent() {
logger.debug("Starting Ydoc server...");
var applicationConfig = ApplicationConfig.load();
var ydoc =
Ydoc.builder()
.hostname(applicationConfig.ydoc().hostname())
.port(applicationConfig.ydoc().port())
.build();
try {
ydoc.start();
this.supervisor.registerService(ydoc);
} catch (Exception e) {
throw new RuntimeException(e);
var ydocEnabled =
System.getenv(ENABLED_YDOC) == null
? false
: Boolean.parseBoolean(System.getenv(ENABLED_YDOC));
if (ydocEnabled) {
logger.debug("Starting Ydoc server...");
var applicationConfig = ApplicationConfig.load();
var ydoc =
Ydoc.builder()
.hostname(applicationConfig.ydoc().hostname())
.port(applicationConfig.ydoc().port())
.build();
try {
ydoc.start();
this.supervisor.registerService(ydoc);
} catch (Exception e) {
throw new RuntimeException(e);
}
logger.debug("Started Ydoc server");
} else {
logger.debug("Reverting to Node.js Ydoc");
}
logger.debug("Started Ydoc server.");
}
}