private async Task CheckSubscriptionsAsync(UpdateFrequency targetUpdateFrequency, CancellationToken cancellationToken) { using (Logger.BeginScope($"Updating {targetUpdateFrequency} subscriptions")) { var subscriptionsToUpdate = from sub in Context.Subscriptions where sub.Enabled let updateFrequency = JsonExtensions.JsonValue(sub.PolicyString, "lax $.UpdateFrequency") where updateFrequency == ((int)targetUpdateFrequency).ToString() let latestBuild = sub.Channel.BuildChannels.Select(bc => bc.Build) .Where(b => (sub.SourceRepository == b.GitHubRepository || sub.SourceRepository == b.AzureDevOpsRepository)) .OrderByDescending(b => b.DateProduced) .FirstOrDefault() where latestBuild != null where sub.LastAppliedBuildId == null || sub.LastAppliedBuildId != latestBuild.Id select new { subscription = sub.Id, latestBuild = latestBuild.Id }; var subscriptionsAndBuilds = await subscriptionsToUpdate.ToListAsync(cancellationToken); Logger.LogInformation($"Will update '{subscriptionsAndBuilds.Count}' subscriptions"); foreach (var s in subscriptionsAndBuilds) { Logger.LogInformation($"Will update {s.subscription} to build {s.latestBuild}"); await UpdateSubscriptionAsync(s.subscription, s.latestBuild); } } }
public void ExecuteOperations_NoRecurringOperationsHaveMatured_SetsUpdateFrequency( int recurringOperationCount, int intervalMilliseconds, UpdateFrequency expectedUpdateFrequency) { var testContext = new TestContext(); var mockRecurringOperationConstructors = Enumerable.Repeat(0, recurringOperationCount) .Select(x => testContext.MakeFakeRecurringOperationConstructor(null, 2)) .ToArray(); var interval = TimeSpan.FromMilliseconds(intervalMilliseconds); foreach (var mockRecurringOperationConstructor in mockRecurringOperationConstructors) { testContext.Uut.RegisterRecurringOperation(interval, mockRecurringOperationConstructor.Object); } testContext.Uut.ExecuteOperations(); testContext.MockGridProgramRuntimeInfo.ShouldHaveReceivedSet(x => x.UpdateFrequency = It.Is <UpdateFrequency>(y => y.HasFlag(expectedUpdateFrequency))); testContext.Uut.ScheduledOperations.ShouldBeEmpty(); mockRecurringOperationConstructors.ForEach(mockRecurringOperation => mockRecurringOperation.ShouldNotHaveReceived(x => x())); }
public void Update(TimeSpan timestamp, UpdateFrequency updateFlags) { runs++; if (runs % 10 == 0) { if (!controller.IsMainCockpit) { SelectController(); } AutoSelectMode(); Drive.MoveIndicators = MergeIndicators(controller.MoveIndicator, MoveIndicatorOverride); Drive.RotationIndicators = MergeIndicators(new Vector3(controller.RotationIndicator, controller.RollIndicator * 9), RotationIndicatorOverride); Drive.autoStop = controller.DampenersOverride; if (enablePrecisionAim) { Drive.RotationIndicators *= 1 / precisionAimFactor; } else { Drive.RotationIndicators *= mouseSpeed; } Drive.enableLateralOverride = enableLateralOverride; Drive.Drive(); } }
public ProgrammableBlock(Program program, UpdateFrequency updateFrequency = UpdateFrequency.Update10) { this.program = program; program.Runtime.UpdateFrequency = updateFrequency; textSurface = program.Me.GetSurface(0); textSurface.ContentType = ContentType.SCRIPT; }
public void Update(TimeSpan timestamp, UpdateFrequency updateFlags) { runs++; if (QueueReload > 0) { QueueReload--; if (QueueReload == 0) { Reload(); } } if (runs % 10 == 0) { UpdateInventories(); if (!LoadingInventory && !UnloadingInventory && AutoReload && AutoReloadInterval > 0) { if (AutoReloadTicker > 0) { AutoReloadTicker--; } else { AutoReloadTicker = AutoReloadInterval; Reload(); } } } }
public void Update(TimeSpan timestamp, UpdateFrequency updateFlags) { if (TargetKey.Item2 != 0) { AimAtTarget(timestamp); } }
public GyroControl(IMyCubeBlock rc, UpdateFrequency tickSpeed, List <IMyGyro> gyros) { if (rc == null) { throw new Exception("Reference block null."); } this.rc = rc; this.gyros = gyros; double factor = 1; if (tickSpeed == UpdateFrequency.Update10) { factor = 10; } else if (tickSpeed == UpdateFrequency.Update100) { factor = 100; } double secondsPerTick = (1.0 / 60) * factor; anglePID = new VectorPID(gyroP / factor, gyroI / factor, gyroD / factor, -gyroMax, gyroMax, secondsPerTick); Reset(); }
private async Task CheckSubscriptionsAsync(UpdateFrequency targetUpdateFrequency, CancellationToken cancellationToken) { using (_operations.BeginOperation($"Updating {targetUpdateFrequency} subscriptions")) { var enabledSubscriptionsWithTargetFrequency = (await Context.Subscriptions .Where(s => s.Enabled) .Include(s => s.Channel) .ThenInclude(c => c.BuildChannels) .ThenInclude(bc => bc.Build) .ToListAsync()) .Where(s => s.PolicyObject.UpdateFrequency == targetUpdateFrequency); int subscriptionsUpdated = 0; foreach (var subscription in enabledSubscriptionsWithTargetFrequency) { Build latestBuildInTargetChannel = subscription.Channel.BuildChannels.Select(bc => bc.Build) .Where(b => (subscription.SourceRepository == b.GitHubRepository || subscription.SourceRepository == b.AzureDevOpsRepository)) .OrderByDescending(b => b.DateProduced) .FirstOrDefault(); bool isThereAnUnappliedBuildInTargetChannel = latestBuildInTargetChannel != null && (subscription.LastAppliedBuild == null || subscription.LastAppliedBuildId != latestBuildInTargetChannel.Id); if (isThereAnUnappliedBuildInTargetChannel) { Logger.LogInformation($"Will update {subscription.Id} to build {latestBuildInTargetChannel.Id}"); await UpdateSubscriptionAsync(subscription.Id, latestBuildInTargetChannel.Id); subscriptionsUpdated++; } } Logger.LogInformation($"Updated '{subscriptionsUpdated}' subscriptions"); } }
public SitemapUrl(string location, string image, UpdateFrequency frequency, DateTime updatedOn) { Location = location; Image = image; UpdateFrequency = frequency; UpdatedOn = updatedOn; }
public void Update(TimeSpan timestamp, UpdateFrequency updateFlags) { //profiler.StartSectionWatch("Baseline"); //profiler.StopSectionWatch("Baseline"); // //if ((updateFlags & UpdateFrequency.Update10) != 0) run++; // //profiler.StartSectionWatch("GetCommands"); //if ((updateFlags & UpdateFrequency.Update10) != 0) GetCommands(timestamp); //profiler.StopSectionWatch("GetCommands"); // //profiler.StartSectionWatch("Do Tasks"); //if ((updateFlags & UpdateFrequency.Update10) != 0 && run % 3 == 0) DoTasks(timestamp); //profiler.StopSectionWatch("Do Tasks"); // //profiler.StartSectionWatch("Add Tasks"); //if ((updateFlags & UpdateFrequency.Update10) != 0) TryAddTaskFromWaitingCommand(timestamp); //profiler.StopSectionWatch("Add Tasks"); if ((updateFlags & UpdateFrequency.Update10) != 0) { run++; if (run % 3 == 0) { GetCommands(timestamp); TryAddTaskFromWaitingCommand(timestamp); DoTasks(timestamp); } } }
public void Update(TimeSpan timestamp, UpdateFrequency updateFlags) { runs++; if (runs % 10 == 0) { if (TurnOffWheels) { CheckWheels(); } if (TurnOffGyros) { CheckGyros(); } if (TurnOffHydros) { CheckHydros(); } } if (runs % 30 == 0) { if (AutoAddWheels) { AddWheels(); } } }
public void Update(TimeSpan timestamp, UpdateFrequency updateFlags) { run++; if (run == kRunEveryXUpdates) { bool hasPos = targetPosition != Vector3D.Zero || targetDrift != Vector3D.Zero; if (hasPos || tActive) { tActive = hasPos; if (targetDrift != Vector3D.Zero && targetPosition != Vector3D.Zero) { targetPosition += targetDrift * kRunEveryXUpdates / 60; } SetThrusterPowers(); } bool hasDir = targetDirection != Vector3D.Zero || targetUp != Vector3D.Zero; if (hasDir || rActive) { rActive = hasDir; SetGyroPowers(); } if (hasPos || hasDir) { UpdateFrequency = UpdateFrequency.Update1; } else if (UpdateFrequency == UpdateFrequency.Update1) { UpdateFrequency = UpdateFrequency.Update10; Clear(); } run = 0; } }
public WheelControl(IMyShipController rc, UpdateFrequency tickSpeed, List <IMyMotorSuspension> wheels) { if (rc == null) { throw new Exception("Ship controller null."); } this.rc = rc; this.wheels = wheels.Select(x => new Wheel(x, GetForce(x))).ToList(); double factor = 1; if (tickSpeed == UpdateFrequency.Update10) { factor = 10; } else if (tickSpeed == UpdateFrequency.Update100) { factor = 100; } double secondsPerTick = (1.0 / 60) * factor; anglePID = new PID(P2 / factor, I2 / factor, D2 / factor, 0.2 / factor, secondsPerTick); forwardPID = new PID(P / factor, I / factor, D / factor, 0.2 / factor, secondsPerTick); Reset(); }
/// <summary> /// Ctor /// </summary> /// <param name="location">URL of the page</param> /// <param name="alternateLocations">List of the page urls</param> /// <param name="frequency">Update frequency</param> /// <param name="updatedOn">Updated on</param> public SitemapUrl(string location, IList <string> alternateLocations, UpdateFrequency frequency, DateTime updatedOn) { Location = location; AlternateLocations = alternateLocations; UpdateFrequency = frequency; UpdatedOn = updatedOn; }
public UpdateRegister(Updatable updatedObject, String tag) { this.tag = tag; this.updatedObject = updatedObject; updatesPassed = 0; frequency = UpdateFrequency.One; timeElapsedSinceLastUpdate = 0; }
void DoTick100S(UpdateFrequency freq) { foreach (var h in StaggerBins[StaggerIndex]) { h(UpdateFrequency.Update100); } StaggerIndex = (StaggerIndex + 1) % StaggerBins.Length; }
void handleShutdownState() { log(Console.LogType.Info, "Shutdown system"); UpdateFrequency = UpdateFrequency.Update100; // switch to stopped state switchState(State.Stopped); }
/// <summary> /// Writes the url location to the writer. /// </summary> /// <param name="urlPath">Url of indexed location (don't put root url information in).</param> /// <param name="frequency">Update frequency - always, hourly, daily, weekly, yearly, never.</param> /// <param name="lastUpdated">Date last updated.</param> protected void WriteUrlLocation(string url, UpdateFrequency updateFrequency, DateTime lastUpdated) { _writer.WriteStartElement("url"); _writer.WriteElementString("loc", String.Format("{0}/{1}", _rootUrl, url)); _writer.WriteElementString("changefreq", updateFrequency.ToString().ToLower()); _writer.WriteElementString("lastmod", lastUpdated.ToString(DateFormat)); _writer.WriteEndElement(); }
private void MoveItem(UpdateEntry update, UpdateFrequency frequency) { int index = (int)frequency; Updater[] list = updaters[index]; list[frameUpdateIndex[index]].AddMovedItem(update); }
public void Update(TimeSpan timestamp, UpdateFrequency updateFlags) { UpdateDrills(); if (Recalling > 0) { Recalling--; } }
public UpdateRegister(Updatable updatedObject, String tag) { this.tag = tag; this.updatedObject = updatedObject; updatesPassed = 0; frequency = UpdateFrequency.One; timeElapsedSinceLastUpdate = 0; }
/// <summary> /// Creates a subscription object based on a standard set of test inputs /// </summary> public static Subscription BuildSubscription(string repo1Uri, string repo2Uri, string targetBranch, string channelName, string subscriptionId, UpdateFrequency updateFrequency, bool batchable, List <string> mergePolicyNames = null, List <string> ignoreChecks = null) { Subscription expectedSubscription = new Subscription(Guid.Parse(subscriptionId), true, repo1Uri, repo2Uri, targetBranch); expectedSubscription.Channel = new Channel(42, channelName, "test"); expectedSubscription.Policy = new SubscriptionPolicy(batchable, updateFrequency); List <MergePolicy> mergePolicies = new List <MergePolicy>(); if (mergePolicyNames == null) { expectedSubscription.Policy.MergePolicies = mergePolicies.ToImmutableList <MergePolicy>(); return(expectedSubscription); } if (mergePolicyNames.Contains(MergePolicyConstants.StandardMergePolicyName)) { mergePolicies.Add(new MergePolicy { Name = MergePolicyConstants.StandardMergePolicyName }); } if (mergePolicyNames.Contains(MergePolicyConstants.NoExtraCommitsMergePolicyName)) { mergePolicies.Add( new MergePolicy { Name = MergePolicyConstants.NoExtraCommitsMergePolicyName }); } if (mergePolicyNames.Contains(MergePolicyConstants.AllCheckSuccessfulMergePolicyName) && ignoreChecks.Any()) { mergePolicies.Add( new MergePolicy { Name = MergePolicyConstants.AllCheckSuccessfulMergePolicyName, Properties = ImmutableDictionary.Create <string, JToken>() .Add(MergePolicyConstants.IgnoreChecksMergePolicyPropertyName, JToken.FromObject(ignoreChecks)) }); } if (mergePolicyNames.Contains(MergePolicyConstants.NoRequestedChangesMergePolicyName)) { mergePolicies.Add( new MergePolicy { Name = MergePolicyConstants.NoRequestedChangesMergePolicyName, Properties = ImmutableDictionary.Create <string, JToken>() }); } expectedSubscription.Policy.MergePolicies = mergePolicies.ToImmutableList <MergePolicy>(); return(expectedSubscription); }
private void WriteUrlLocation(string url, UpdateFrequency updateFrequency, DateTime lastUpdated) { _writer.WriteStartElement("url"); string loc = XmlEncode(url); _writer.WriteElementString("loc", loc); _writer.WriteElementString("changefreq", updateFrequency.ToString().ToLowerInvariant()); _writer.WriteElementString("lastmod", lastUpdated.ToString(DateFormat)); _writer.WriteEndElement(); }
public void Pause() { if (Runtime.UpdateFrequency != UpdateFrequency.None) { frequencyAtPause = Runtime.UpdateFrequency; } Runtime.UpdateFrequency = UpdateFrequency.None; }
public UpdatesSubscription(Action <Pack> consumer, UpdateFrequency frequency, Action <UpdatesSubscription> unsubscribeAction) { Contract.Requires(consumer, "consumer").NotToBeNull(); Contract.Requires(frequency, "frequency").ToBeDefinedEnumValue(); this.Consumer = consumer; this.Frequency = frequency; this.UnsubscribeAction = unsubscribeAction; }
public void Update(TimeSpan timestamp, UpdateFrequency updateFlags) { runs++; if (runs % 60 == 0) { CheckTags(); } }
protected virtual void WriteUrlLocation(string url, UpdateFrequency updateFrequency, DateTime lastUpdated) { _writer.WriteStartElement("url"); string loc = XmlHelper.XmlEncode(url); _writer.WriteElementString("loc", loc); _writer.WriteElementString("changefreq", updateFrequency.ToString().ToLowerInvariant()); _writer.WriteElementString("lastmod", lastUpdated.ToString(DateFormat)); _writer.WriteEndElement(); }
protected void WriteUrlLocation(string url, UpdateFrequency updateFrequency, DateTime lastModifiedOnUtc) { _writer.WriteStartElement("url"); var loc = XmlHelper.XmlEncode(url); _writer.WriteElementString("loc", loc); _writer.WriteElementString("changefreq", updateFrequency.ToString().ToLowerInvariant()); _writer.WriteElementString("lastmod", lastModifiedOnUtc.ToString(DATE_FORMAT)); _writer.WriteEndElement(); }
void Update(UpdateFrequency freq) { foreach (var a in _Airlocks.Values) { if (a.CurrentState == "Outer Doors Open" || a.CurrentState == "Inner Doors Open") { a.Interval += Owner.PB.Runtime.TimeSinceLastRun.TotalSeconds; } a.Update(); } }
public ISubscription SubscribeToUpdates(Action <Pack> notificationConsumer, UpdateFrequency frequency = UpdateFrequency.Normal) { lock (this.m_lock) { var subscription = new UpdatesSubscription(notificationConsumer, frequency, this.UnsubscribeConsumer); this.m_subscriptions.Add(subscription); this.UpdateMonitoringTask(); return(subscription); } }
public bool UpdateTypeMatchesFrequency(UpdateType type, UpdateFrequency frequency) { if (((frequency == UpdateFrequency.Once) && ((type & (UpdateType.Once | UpdateType.Update1 | UpdateType.Update10 | UpdateType.Update100)) != 0)) || ((frequency == UpdateFrequency.Update1) && ((type & UpdateType.Update1) != 0)) || ((frequency == UpdateFrequency.Update10) && ((type & UpdateType.Update10) != 0)) || ((frequency == UpdateFrequency.Update100) && ((type & UpdateType.Update100) != 0))) { return(true); } return(false); }
private void WriteProducts() { ProductCollection products = ProductManager.GetAllProducts(false); foreach (Product product in products) { string url = SEOHelper.GetProductURL(product); UpdateFrequency updateFrequency = UpdateFrequency.weekly; DateTime updateTime = product.UpdatedOn; WriteUrlLocation(url, updateFrequency, updateTime); } }
protected void WriteUrlLocation(string url, UpdateFrequency updateFrequency, DateTime lastUpdated) { if (url.IsEmpty()) return; string loc = XmlHelper.XmlEncode(url); if (url.IsEmpty()) return; _writer.WriteStartElement("url"); _writer.WriteElementString("loc", loc); //_writer.WriteElementString("changefreq", updateFrequency.ToString().ToLowerInvariant()); _writer.WriteElementString("lastmod", lastUpdated.ToString(DateFormat)); _writer.WriteEndElement(); }
public RemoteTemplateSettings(List<TemplateSource> sources,UpdateFrequency updateInterval) { this.Schema = "http://json.schemastore.org/templatesources.json"; this.Sources = sources; this.UpdateInterval = updateInterval; }
public Timestamp(UpdateFrequency frequency) { this.Update = frequency; }