Skip to content

the changed file paths are looped through till stopped#3

Merged
TheGreatShan merged 2 commits intomainfrom
watcher-setup
Jun 27, 2025
Merged

the changed file paths are looped through till stopped#3
TheGreatShan merged 2 commits intomainfrom
watcher-setup

Conversation

@TheGreatShan
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings June 27, 2025 16:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an infinite loop in Program.cs that continuously loops through changed file paths from a watcher service.

  • Added a service call to read app settings from a JSON file
  • Instantiated a watcher and implemented an infinite loop to print changed file paths repeatedly

Comment thread CasaOSDeltaSynchronizer/Program.cs Outdated
Comment on lines +11 to +14
while (true)
{
watcher.ChangedFilePaths.ForEach(Console.WriteLine);
}
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a delay or termination condition to the infinite loop to avoid high CPU usage and to allow graceful shutdown.

Suggested change
while (true)
{
watcher.ChangedFilePaths.ForEach(Console.WriteLine);
}
var cancellationTokenSource = new CancellationTokenSource();
Console.CancelKeyPress += (sender, e) =>
{
e.Cancel = true;
cancellationTokenSource.Cancel();
};
while (!cancellationTokenSource.Token.IsCancellationRequested)
{
watcher.ChangedFilePaths.ForEach(Console.WriteLine);
Thread.Sleep(1000); // Add a delay of 1 second
}
Console.WriteLine("Program terminated gracefully.");

Copilot uses AI. Check for mistakes.
@TheGreatShan TheGreatShan merged commit cdc1431 into main Jun 27, 2025
3 of 4 checks passed
@TheGreatShan TheGreatShan deleted the watcher-setup branch June 27, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants