Currently when invoking synchronization from headless environment, via REST Command API, one has to keep request open for command to run. For longer execution REST call would time out and cause command execution to be interrupted. Since it is also not possible to monitor the command execution to know how much more content has to be still synchronized (due to nature of synchronization), it makes it also very difficult to configure timeout of the REST call correctly.
- add support for async invocation (e.g. via using scheduled task with near-immediate execution) to start command itself asynchronously and only return some kind of job ID.
- add REST API/Servlet to check the status of the job by specifying previously provided job ID. It would be enough to provide JSON statuses such as NOT_STARTED, RUNNING, DONE, FAILURE, with more detailed error message for the last one so that one can check the job status periodically.