[banshee] [ServiceStack] Add a startup job for faster startup
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [ServiceStack] Add a startup job for faster startup
- Date: Wed, 11 Aug 2010 01:18:22 +0000 (UTC)
commit 41e33a3de7d8e5182e0727bf5f723d220d7a039c
Author: Gabriel Burt <gabriel burt gmail com>
Date: Tue Aug 10 18:14:11 2010 -0700
[ServiceStack] Add a startup job for faster startup
It has a SpeedSensitive priority hint and uses all resources, so the
scheduler will block jobs like save-metadata, Mirage analysis, etc until
the UI is fully loaded. Fixes bgo#626487 and bgo#626486.
.../Banshee.ServiceStack/JobScheduler.cs | 35 ++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.ServiceStack/JobScheduler.cs b/src/Core/Banshee.Services/Banshee.ServiceStack/JobScheduler.cs
index c043c03..cbcfc83 100644
--- a/src/Core/Banshee.Services/Banshee.ServiceStack/JobScheduler.cs
+++ b/src/Core/Banshee.Services/Banshee.ServiceStack/JobScheduler.cs
@@ -34,6 +34,41 @@ namespace Banshee.ServiceStack
{
public class JobScheduler : Scheduler, IRequiredService
{
+ class StartupJob : Job
+ {
+ public StartupJob ()
+ {
+ Title = "Startup Job";
+ PriorityHints = PriorityHints.SpeedSensitive;
+ SetResources (Resource.Cpu, Resource.Disk, Resource.Database);
+ IsBackground = true;
+ }
+
+ public void Finish ()
+ {
+ OnFinished ();
+ }
+ }
+
+ StartupJob startup_job = new StartupJob ();
+
+ public JobScheduler ()
+ {
+ // This startup job blocks any other jobs from starting
+ // until we're up and running.
+ Add (startup_job);
+ Application.ClientStarted += OnClientStarted;
+ }
+
+ private void OnClientStarted (Client client)
+ {
+ Application.ClientStarted -= OnClientStarted;
+ Application.RunTimeout (1000, delegate {
+ startup_job.Finish ();
+ return false;
+ });
+ }
+
string IService.ServiceName {
get { return "JobScheduler"; }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]