speed tweaks

This commit is contained in:
Vincent Cloutier 2023-03-18 16:16:03 -04:00
parent 71dfe4b019
commit dd7786ce38
3 changed files with 3 additions and 4 deletions

View file

@ -14,7 +14,7 @@
public int FailingTwitterUserCleanUpThreshold { get; set; } public int FailingTwitterUserCleanUpThreshold { get; set; }
public int FailingFollowerCleanUpThreshold { get; set; } = -1; public int FailingFollowerCleanUpThreshold { get; set; } = -1;
public int UserCacheCapacity { get; set; } public int UserCacheCapacity { get; set; } = 20_000;
public int TweetCacheCapacity { get; set; } = 20_000; public int TweetCacheCapacity { get; set; } = 20_000;
public int ParallelTwitterRequests { get; set; } = 10; public int ParallelTwitterRequests { get; set; } = 10;
public int ParallelFediversePosts { get; set; } = 10; public int ParallelFediversePosts { get; set; } = 10;

View file

@ -106,7 +106,6 @@ namespace BirdsiteLive.Domain
var response = await client.SendAsync(httpRequestMessage); var response = await client.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
_logger.LogInformation("Sent tweet to " + targetHost); _logger.LogInformation("Sent tweet to " + targetHost);
_logger.LogInformation("Tweet content is " + json);
return response.StatusCode; return response.StatusCode;
} }

View file

@ -19,7 +19,7 @@ namespace BirdsiteLive.Twitter
private readonly MemoryCache _userCache; private readonly MemoryCache _userCache;
private readonly MemoryCacheEntryOptions _cacheEntryOptions = new MemoryCacheEntryOptions() private readonly MemoryCacheEntryOptions _cacheEntryOptions = new MemoryCacheEntryOptions()
.SetSize(10000)//Size amount .SetSize(1)//Size amount
//Priority on removing when reaching size limit (memory pressure) //Priority on removing when reaching size limit (memory pressure)
.SetPriority(CacheItemPriority.Low) .SetPriority(CacheItemPriority.Low)
// Keep in cache for this time, reset time if accessed. // Keep in cache for this time, reset time if accessed.
@ -34,7 +34,7 @@ namespace BirdsiteLive.Twitter
_userCache = new MemoryCache(new MemoryCacheOptions() _userCache = new MemoryCache(new MemoryCacheOptions()
{ {
SizeLimit = 3000 //TODO make this use number of entries in db SizeLimit = settings.UserCacheCapacity
}); });
} }
#endregion #endregion