//タイマー設定
- this.RefreshThrottlingTimer = new ThrottlingTimer(TimeSpan.Zero,
+ var streamingRefreshInterval = TimeSpan.FromSeconds(SettingManager.Common.UserstreamPeriod);
+ this.RefreshThrottlingTimer = new ThrottlingTimer(streamingRefreshInterval,
() => this.InvokeAsync(() => this.RefreshTimeline()));
TimerTimeline.AutoReset = true;
private void TimerInterval_Changed(object sender, IntervalChangedEventArgs e) //Handles SettingDialog.IntervalChanged
{
if (!TimerTimeline.Enabled) return;
+
+ if (e.UserStream)
+ {
+ var interval = TimeSpan.FromSeconds(SettingManager.Common.UserstreamPeriod);
+ var newTimer = new ThrottlingTimer(interval, () => this.InvokeAsync(() => this.RefreshTimeline()));
+ var oldTimer = Interlocked.Exchange(ref this.RefreshThrottlingTimer, newTimer);
+ oldTimer.Dispose();
+ }
+
ResetTimers = e;
}
private static int pubSearchCounter = 0;
private static int userTimelineCounter = 0;
private static int listsCounter = 0;
- private static int usCounter = 0;
private static int ResumeWait = 0;
private static int refreshFollowers = 0;
if (pubSearchCounter > 0) Interlocked.Decrement(ref pubSearchCounter);
if (userTimelineCounter > 0) Interlocked.Decrement(ref userTimelineCounter);
if (listsCounter > 0) Interlocked.Decrement(ref listsCounter);
- if (usCounter > 0) Interlocked.Decrement(ref usCounter);
Interlocked.Increment(ref refreshFollowers);
var refreshTasks = new List<Task>();
refreshTasks.Add(this.RefreshTabAsync<ListTimelineTabModel>());
ResetTimers.Lists = false;
}
- if (ResetTimers.UserStream || usCounter <= 0 && SettingManager.Common.UserstreamPeriod > 0)
- {
- Interlocked.Exchange(ref usCounter, SettingManager.Common.UserstreamPeriod);
- if (this.tw.UserStreamActive)
- this.RefreshTimeline();
- ResetTimers.UserStream = false;
- }
if (refreshFollowers > 6 * 3600)
{
Interlocked.Exchange(ref refreshFollowers, 0);
this._statuses.DistributePosts();
- if (SettingManager.Common.UserstreamPeriod > 0) return;
-
this.RefreshThrottlingTimer.Invoke();
}