This repository has been archived on 2023-06-30. You can view files and clone it, but cannot push or open issues or pull requests.
2chBackAPI/BufferControllers/BufferFill.cs

24 lines
820 B
C#
Raw Normal View History

2022-11-25 22:40:17 +10:00
using NeDvachAPI.DBControllers;
using NeDvachAPI.Models;
namespace NeDvachAPI.BufferControllers
2022-11-25 12:37:26 +10:00
{
public class BufferFill
{
public static bool FillBuffer(string board) //method to get buffer of information, which is being ran while API is started
{
List<Post> posts = DBchat.ThreadsList(board);
APIThreadBuffer.WriteThreadPreviewsBuffer(posts);
Console.WriteLine("Заполняю буфер оп-постами");
2022-12-20 23:45:22 +10:00
for (int threadId = 1; threadId <= posts.Count; threadId++)
2022-11-25 12:37:26 +10:00
{
2022-12-20 23:45:22 +10:00
APIThreadBuffer.WriteThreadsBuffer(DBchat.PostsList(board, threadId));
2022-11-25 12:37:26 +10:00
}
2022-12-20 23:45:22 +10:00
Console.WriteLine($@"Буферизую треды с {1} по {posts.Count}.");
2022-11-25 22:40:17 +10:00
return true;
2022-11-25 12:37:26 +10:00
}
}
}