Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot Reload File IO -> React to 1 file change notification per file change #2424

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seantleonard
Copy link
Contributor

Why make this change?

What is this change?

  • Adds file hash persistence mechanism and compares hashes old versus changed file and only when different does DAB proceed with hot reload.

How was this tested?

TBD

  • Integration Tests
  • Unit Tests

… events trigger hot reload, we only act on the first event which has a differing filecontents. If no file changes have actually occurred, we shouldn't act on the file change notification. Additional add protection for reading file with read inent version read/write which was causing issues in some hot reload scenarios.
@seantleonard seantleonard added the 🔥Hot Reload Tasks related to DAB's Hot Reload feature proposal label Oct 14, 2024
return;
}

byte[] updatedRuntimeConfigFileHash = FileUtilities.ComputeHash(filePath: _fileWatcher.Path + "/" + _fileWatcher.Filter);
Copy link
Contributor

Choose a reason for hiding this comment

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

it will be good to add in the comments why we needed to computeHash

using System.Text;
using System.Threading.Tasks;

namespace Azure.DataApiBuilder.Config.Utilities
Copy link
Contributor

Choose a reason for hiding this comment

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

can be added some class/method summary

{
public static byte[] ComputeHash(string filePath)
{
int runCount = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

what is runCount here?

{
int runCount = 1;

while (runCount < 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

why 4?

}
}

return new byte[20];
Copy link
Contributor

Choose a reason for hiding this comment

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

why 20? can we something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔥Hot Reload Tasks related to DAB's Hot Reload feature proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hot Reload - File IO issues -> DAB reacts to multiple file change notifications for single file change
2 participants