mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
s3: fix storage limit rolloever
This commit is contained in:
@@ -52,6 +52,17 @@ namespace Notesnook.API.Helpers
|
||||
return fileSize > maxFileSize;
|
||||
}
|
||||
|
||||
public static Limit RolloverStorageLimit(Limit? limit)
|
||||
{
|
||||
var updatedAt = DateTimeOffset.FromUnixTimeMilliseconds(limit?.UpdatedAt ?? 0);
|
||||
if (limit == null || DateTimeOffset.UtcNow.Year > updatedAt.Year || DateTimeOffset.UtcNow.Month > updatedAt.Month)
|
||||
{
|
||||
limit = new Limit { UpdatedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), Value = 0 };
|
||||
return limit;
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
private static readonly string[] sizes = ["B", "KB", "MB", "GB", "TB"];
|
||||
public static string FormatBytes(long size)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user