4 Commits

Author SHA1 Message Date
Abdullah Atta
0a8c707387 docker: do not publish trimmed images 2026-01-01 10:36:02 +05:00
Abdullah Atta
8908b8c6ed sync: minor refactors 2026-01-01 10:35:35 +05:00
Abdullah Atta
da8df8973c sync: reduce batch size for fetching chunks 2025-12-30 12:52:56 +05:00
Abdullah Atta
7e50311c92 sync: reduce device ids chunk size 2025-12-30 12:52:36 +05:00
7 changed files with 5 additions and 14 deletions

View File

@@ -27,8 +27,6 @@ FROM build AS publish
RUN dotnet publish -c Release -o /app/publish \
#--runtime alpine-x64 \
--self-contained true \
/p:TrimMode=partial \
/p:PublishTrimmed=true \
/p:PublishSingleFile=true \
/p:JsonSerializerIsReflectionEnabledByDefault=true \
-a $TARGETARCH

View File

@@ -247,7 +247,7 @@ namespace Notesnook.API.Hubs
var chunks = PrepareChunks(
userId,
ids,
size: 1000,
size: 100,
resetSync: device.IsSyncReset,
maxBytes: 7 * 1024 * 1024
);

View File

@@ -91,11 +91,7 @@ namespace Notesnook.API.Repositories
public void DeleteByUserId(string userId)
{
var filter = Builders<SyncItem>.Filter.Eq("UserId", userId);
var writes = new List<WriteModel<SyncItem>>
{
new DeleteManyModel<SyncItem>(filter)
};
dbContext.AddCommand((handle, ct) => Collection.BulkWriteAsync(handle, writes, options: null, ct));
dbContext.AddCommand((handle, ct) => Collection.DeleteManyAsync(handle, filter, null, ct));
}
public void Upsert(SyncItem item, string userId, long dateSynced)

View File

@@ -73,7 +73,7 @@ namespace Notesnook.API.Services
return result;
}
const int MaxIdsPerChunk = 400_000;
const int MaxIdsPerChunk = 25_000;
public async Task AppendIdsAsync(string userId, string deviceId, string key, IEnumerable<ItemKey> ids)
{
var filter = DeviceIdsChunkFilter(userId, deviceId, key) & Builders<DeviceIdsChunk>.Filter.Where(x => x.Ids.Length < MaxIdsPerChunk);
@@ -81,7 +81,7 @@ namespace Notesnook.API.Services
if (chunk != null)
{
var update = Builders<DeviceIdsChunk>.Update.PushEach(x => x.Ids, ids.Select(i => i.ToString()));
var update = Builders<DeviceIdsChunk>.Update.AddToSetEach(x => x.Ids, ids.Select(i => i.ToString()));
await repositories.DeviceIdsChunks.Collection.UpdateOneAsync(
Builders<DeviceIdsChunk>.Filter.Eq(x => x.Id, chunk.Id),
update

View File

@@ -182,6 +182,7 @@ namespace Notesnook.API.Services
public async Task DeleteUserAsync(string userId)
{
logger.LogInformation("Deleting user {UserId}", userId);
var cc = new CancellationTokenSource();
Repositories.Notes.DeleteByUserId(userId);

View File

@@ -27,8 +27,6 @@ FROM build AS publish
RUN dotnet publish -c Release -o /app/publish \
#--runtime alpine-x64 \
--self-contained true \
/p:TrimMode=partial \
/p:PublishTrimmed=true \
/p:PublishSingleFile=true \
/p:JsonSerializerIsReflectionEnabledByDefault=true \
-a $TARGETARCH

View File

@@ -27,8 +27,6 @@ FROM build AS publish
RUN dotnet publish -c Release -o /app/publish \
#--runtime alpine-x64 \
--self-contained true \
/p:TrimMode=partial \
/p:PublishTrimmed=true \
/p:PublishSingleFile=true \
/p:JsonSerializerIsReflectionEnabledByDefault=true \
-a $TARGETARCH