diff options
author | Lars Vogel | 2019-08-27 09:49:58 +0000 |
---|---|---|
committer | Lars Vogel | 2020-04-27 12:44:25 +0000 |
commit | 2b0662a53a33b8dc7377010f73e363dfe453ec3f (patch) | |
tree | 6d7fe258a3c0de7745ac11b0f2c4636eae9db3e2 | |
parent | e06fd29caa802553d4efcc36c86812e4f910d4b7 (diff) | |
download | rt.equinox.p2-2b0662a53a33b8dc7377010f73e363dfe453ec3f.tar.gz rt.equinox.p2-2b0662a53a33b8dc7377010f73e363dfe453ec3f.tar.xz rt.equinox.p2-2b0662a53a33b8dc7377010f73e363dfe453ec3f.zip |
Bug 443809 - Move work in AutomaticUpdateScheduler to a JobI20200428-0630I20200428-0610
Move the work from the earlyStartup to a Job. This reduces the execution
time of the the early startup workload from 1344ms to 52ms.
Also delays the update check to allow the system to settle before the
update check
Change-Id: I2155d56e35eedd6a76c835be6a5f5a63b4443750
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r-- | bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java index 604b6a292..19833a9a0 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java @@ -21,6 +21,7 @@ import java.util.Date; import java.util.Random; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.internal.p2.garbagecollector.GarbageCollector; import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration.MigrationSupport; @@ -59,15 +60,22 @@ public class AutomaticUpdateScheduler implements IStartup { @Override public void earlyStartup() { AutomaticUpdatePlugin.getDefault().setScheduler(this); - agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.class); - IProfileRegistry registry = agent.getService(IProfileRegistry.class); - IProfile currentProfile = registry.getProfile(IProfileRegistry.SELF); - if (currentProfile != null && new MigrationSupport().performMigration(agent, registry, currentProfile)) { - return; - } - removeUnusedPlugins(registry); - scheduleUpdate(); + Job updateJob = Job.create("Update Job", e -> { //$NON-NLS-1$ + agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.class); + IProfileRegistry registry = agent.getService(IProfileRegistry.class); + IProfile currentProfile = registry.getProfile(IProfileRegistry.SELF); + if (currentProfile != null && new MigrationSupport().performMigration(agent, registry, currentProfile)) { + return; + } + + removeUnusedPlugins(registry); + scheduleUpdate(); + }); + updateJob.setSystem(true); + // allow the system to settle + updateJob.schedule(20000); + } /** |