I managed to work around my issue by using pagination:
List<DriveItem> allItems = new();
var result = await GraphClient.Sites[siteID].Drives[documentLibraryID].Root.Children
.Request()
.Expand("listItem")
.Top(100)
.GetAsync();
var pageIterator = PageIterator<DriveItem>
.CreatePageIterator(
GraphClient,
result,
(item) =>
{
allItems.Add(item);
return true;
});
await pageIterator.IterateAsync();
This way I get the results 100 at a time, which was within the timeout threshold. They are then all added to a List (allItems) so I didn't need to change the rest of my code.