public UpdateCascadeOperationExecutor(DocumentDatabase db, UpdateCascadeSetting setting, UpdateCascadeOperation operation, JsonDocument referencedDoc) { this.db = db; this.services = Services.GetServices(db); this.setting = setting; this.operation = operation; this.referencedDoc = referencedDoc; }
public void Execute(Database.DocumentDatabase database) { try { services = Services.GetServices(database); services.IsShutDownInProgress = false; db = database; this.db.PutIndex(UpdateCascadeOperation.ByStatusIndexName, UpdateCascadeOperation.GetByStatusIndexDefinition()); Task.Factory.StartNew(services.RunningOperationsCoordinator.RestartNotCompletedOperations).ContinueWith(t => { if (t.Status == TaskStatus.Faulted && t.Exception != null) { log.ErrorException("Failed to restart not completed operations", t.Exception); } }); } catch (Exception ex) { log.FatalException("Failed to execute UpdateCascadeStartupTask", ex); } }
public override void Initialize() { base.Initialize(); services = Services.GetServices(this.Database); operationRepository = new Repository<UpdateCascadeOperation>(this.Database); }