mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-10-01 10:49:33 +02:00
s3: fix storage limit rolloever
This commit is contained in:
1 parent
1e8a205719
commit
54d0fdcf4f
4 files changed
+40
-7
No files matched your search
@@ -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