diff --git a/src/Azos.Sky.Server/Fabric/Server/FiberProcessorDaemon.IFiberManager.cs b/src/Azos.Sky.Server/Fabric/Server/FiberProcessorDaemon.IFiberManager.cs index 7a0ecb857..0ffc418b6 100644 --- a/src/Azos.Sky.Server/Fabric/Server/FiberProcessorDaemon.IFiberManager.cs +++ b/src/Azos.Sky.Server/Fabric/Server/FiberProcessorDaemon.IFiberManager.cs @@ -101,7 +101,9 @@ public async Task> GetFiberListAsync(FiberFilter filter) var result = new List(); - var queryArgs = new StoreQueryArgs(filter); + var totalShards = shards.Count(); + + var queryArgs = new StoreQueryArgs(filter, totalShards); foreach(var batch in shards.BatchBy(4)) { diff --git a/src/Azos.Sky.Server/Fabric/Server/StoreQueryArgs.cs b/src/Azos.Sky.Server/Fabric/Server/StoreQueryArgs.cs index 2b44e1044..67ae9dd9b 100644 --- a/src/Azos.Sky.Server/Fabric/Server/StoreQueryArgs.cs +++ b/src/Azos.Sky.Server/Fabric/Server/StoreQueryArgs.cs @@ -24,12 +24,25 @@ namespace Azos.Sky.Fabric public sealed class StoreQueryArgs : TransientModel { public StoreQueryArgs() { } - public StoreQueryArgs(FiberFilter proto) + public StoreQueryArgs(FiberFilter filter, int totalShards) { - proto.CopyFields(this); - if (proto.Id.HasValue) this.Gdid = proto.Id.Value.Gdid; + const int MAX_RECORDS = 512; + + filter.CopyFields(this); + if (filter.Id.HasValue) this.Gdid = filter.Id.Value.Gdid; + + if (totalShards < 1) totalShards = 1; + + var rc = (filter.PagingCount > 0 ? filter.PagingCount : MAX_RECORDS ) / totalShards; + + rc = rc.KeepBetween(1, (MAX_RECORDS / totalShards).AtMinimum(1)); + + RecordCount = rc; } + [Field(Description = "How many records to return")] + public int RecordCount { get; set; } + [Field(Description = "Gdid of the specific fiber or zero")] public GDID? Gdid { get; set; }