Open Qythyx opened 3 years ago
Ok, I won't be able to patch this. I'm on a Mac and the project is super unhappy opening it in Visual Studio for Mac or VSCode on Mac.
Looking at the code I think just changing a few int
s to long
s maybe enough, but I would prefer to write a test to exercise this.
Could this also be causing a System.ArgumentOutOfRangeException when calling Barrel.Current.Add(key, value, TimeSpan.MaxValue);
? The error message is: The added or subtracted value results in an un-representable DateTime.
Parameter name: value'. Looks like a regression of #30.
Changing the call to Barrel.Current.Add(key, value, TimeSpan.FromDays(6000));
seems to work as a workaround.
@jamesmontemagno
In
FileStore.Barrel
theDateTimeToEpochSeconds
converts the expiration date to second from epoch in seconds as an int. This overflows in about 6050 days from now and becomesint.MinValue
, which means it is considered expired. Thisint
should probably be along
instead.If I have time I'll try to patch this, but I wanted to mention this. Also, I didn't look at the other implementations, only
FileStore
.In case you're wondering, I found this problem by trying to set a very distant expiration date. Initially I tried
TimeSpan.MaxValue
but that had this problem. I then triedTimeSpan.FromDays(9999)
and had the same problem. Then I looked at the code and found the problem. I also think thatTimeSpan.MaxValue
should possibly be considered special and never expire.