HaveIBeenPwned / EmailAddressExtractor

A project to rapidly extract all email addresses from any files in a given path
BSD 3-Clause "New" or "Revised" License
68 stars 23 forks source link

Status indication #14

Closed GStefanowich closed 1 year ago

GStefanowich commented 1 year ago

Implemented a status indicator to satisfy issue-#12

To prevent AddressExtractor from becoming a god class and jamming in monitoring things, I created an AddressExtractorMonitor and enclosed the existing logging messages and Stopwatch into it.

I also made it virtual so that you could theoretically easily override the Logging method (Also with a custom timespan)

The default logging interval is every minute, but I expanded the SingleSmallFile.txt to 500,000 lines and it finished in ~2,199ms. So I was testing it in 1s intervals. YMMV

public class MyMonitor : AddressExtractorMonitor
{
    public MyMonitor(): base(TimeSpan.FromSeconds(12)) {}

    public override void Log() {
        // Do something
    }
}
GStefanowich commented 1 year ago

Technically my loop method needs work, as the Addresses are only Union'ed once a file has been fully read. So the Status Indicator isn't fully up to date at all times

May try and tweak this myself

GStefanowich commented 1 year ago

Addresses are now added to the Addresses Set as soon as they are Matched, instead of at the end of each file.