Skip to content

Commit

Permalink
Merge pull request #253 from opentween/fix-duplicate-request
Browse files Browse the repository at this point in the history
起動直後にタイムラインの取得が重複して行われる不具合を修正
  • Loading branch information
upsilon authored Nov 24, 2023
2 parents d0c0a64 + fa14bae commit 4097f14
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- タイムライン更新の次回実行が1時間以上先になる場合は異常値としてタイマーをリセットする
* FIX: 動画のサムネイル表示時に再生可能であることを示すアイコンが表示されない不具合を修正
* FIX: リスト更新時に発生したネットワークエラーが適切に処理されない不具合を修正
* FIX: 起動直後にタイムラインの取得が重複して行われる不具合を修正

==== Ver 3.7.1(2023/07/20)
* FIX: Cookie使用時に複数回ツイートを投稿するとDelaying?のエラーが表示される不具合を修正
Expand Down
12 changes: 7 additions & 5 deletions OpenTween.Tests/TimelineScheduerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ public async Task Callback_Test()
scheduler.Enabled = true;

Assert.True(mockTimer.IsTimerRunning);
Assert.Equal(TimeSpan.Zero, mockTimer.DueTime);
Assert.Equal(TimeSpan.FromMinutes(1), mockTimer.DueTime);

// 0:00:00 - 0:00:10
// 0:01:00 - 0:01:10
TestUtils.DriftTime(TimeSpan.FromMinutes(1));
await mockTimer.Invoke();

Assert.True(mockTimer.IsTimerRunning);
Expand Down Expand Up @@ -95,9 +96,10 @@ public async Task Callback_SystemResumeTest()
scheduler.Enabled = true;

Assert.True(mockTimer.IsTimerRunning);
Assert.Equal(TimeSpan.Zero, mockTimer.DueTime);
Assert.Equal(TimeSpan.FromMinutes(1), mockTimer.DueTime);

// 0:00:00
// 0:01:00
TestUtils.DriftTime(TimeSpan.FromMinutes(1));
await mockTimer.Invoke();

Assert.Equal(1, count); // invoked
Expand All @@ -109,7 +111,7 @@ public async Task Callback_SystemResumeTest()
Assert.True(mockTimer.IsTimerRunning);
Assert.Equal(TimeSpan.FromMinutes(10), mockTimer.DueTime);

// 0:10:00
// 0:11:00
TestUtils.DriftTime(TimeSpan.FromMinutes(10));
await mockTimer.Invoke();

Expand Down
2 changes: 1 addition & 1 deletion OpenTween/TimelineScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void SystemResumed()
public void Reset()
{
foreach (var taskType in TimelineScheduler.AllTaskTypes)
this.LastUpdatedAt[taskType] = DateTimeUtc.MinValue;
this.LastUpdatedAt[taskType] = DateTimeUtc.Now;

this.systemResumeMode = false;
this.RefreshSchedule();
Expand Down

0 comments on commit 4097f14

Please sign in to comment.