Skip to content

Commit e82f042

Browse files
Fix for "No Dispatches appearing" bug. (#149)
* Update ArrowHeadApiService.cs adding From_Timestamp to NewsFeed task * Update HelldiversSyncConfiguration.cs Adding NewsFeedFromTimestamp * Update ArrowHeadApiService.cs added NewsFeedFromTimestamp into ArrowHeadApiService, this prevents a crash. * adding in formatting requests, and fixing what I found to be the acutal issue. ${} isn't to be used in C#! * correcting spacing * Update ArrowHeadApiService.cs * Update ArrowHeadApiService.cs Co-authored-by: Wannes Gennar <dealloc@users.noreply.github.com> --------- Co-authored-by: Wannes Gennar <dealloc@users.noreply.github.com>
1 parent 5c39a61 commit e82f042

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/Helldivers-2-Sync/Configuration/HelldiversSyncConfiguration.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,9 @@ public sealed class HelldiversSyncConfiguration
3535
/// Get the maximum number of entries returned by ArrowHead from the newsfeed API.
3636
/// </summary>
3737
public uint NewsFeedMaxEntries { get; set; } = 1024;
38+
39+
/// <summary>
40+
/// Get all news feed entries that were published after this timestamp
41+
/// </summary>
42+
public uint NewsFeedFromTimestamp { get; set; } = 1000;
3843
}

src/Helldivers-2-Sync/Services/ArrowHeadApiService.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,18 @@ public async Task<Memory<byte>> GetWarStatus(string season, string language, Can
7474
public async Task<Memory<byte>> LoadFeed(string season, string language, CancellationToken cancellationToken)
7575
{
7676
// If the `NewsFeedMaxEntries` flag is not set to 0 we pass it in.
77+
// This parameter needs to be passed or a 400 status code will be returned occasionally.
7778
var request = options.Value.NewsFeedMaxEntries is 0
78-
? BuildRequest($"/api/NewsFeed/{season}", language)
79-
: BuildRequest($"/api/NewsFeed/{season}?maxEntries=${options.Value.NewsFeedMaxEntries}", language);
79+
? BuildRequest($"/api/NewsFeed/{season}?fromTimestamp={options.Value.NewsFeedFromTimestamp}", language)
80+
: BuildRequest($"/api/NewsFeed/{season}?maxEntries={options.Value.NewsFeedMaxEntries}&fromTimestamp={options.Value.NewsFeedFromTimestamp}", language);
8081

8182
using var response = await http.SendAsync(request, cancellationToken);
8283

8384
// Throw on error responses so we don't have to look down the entire serialisation tree.
8485
response.EnsureSuccessStatusCode();
8586

8687
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken);
88+
8789
return await CollectStream(stream, cancellationToken);
8890
}
8991

0 commit comments

Comments
 (0)