Skip to content

Commit 512ee4c

Browse files
committed
💾 🔧 Feat, Fix(SyncCodes): Make sure per 3 sec, files catalog will be updated
Fix: Use correct file name to request API `/file/<name>`
1 parent 33fb678 commit 512ee4c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎Utils/SyncCodes/Program.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@
6565

6666
void RunServer(Context context)
6767
{
68+
var timer = new Timer(3000)
69+
{
70+
AutoReset = true,
71+
};
72+
timer.Elapsed += (_, _) => context.RefreshFiles();
73+
timer.Start();
74+
6875
app.MapGet(
6976
"/",
7077
() => Results.Content(
@@ -177,7 +184,10 @@ await catalogResponse.Content.ReadAsStringAsync(),
177184
else
178185
{
179186
var filePath = Path.Combine(workBase, comparison.Path);
180-
var fileContentResponse = await client.GetAsync(fileApi + Convert.ToBase64String(Encoding.UTF8.GetBytes(filePath)));
187+
var fileName = Convert.ToBase64String(
188+
Encoding.UTF8.GetBytes(comparison.Path)
189+
);
190+
var fileContentResponse = await client.GetAsync($"{fileApi}{fileName}");
181191
if (!fileContentResponse.IsSuccessStatusCode)
182192
{
183193
app.Logger.LogError(

0 commit comments

Comments
 (0)