From c60e4dc1095ef90a790582cacfad27c972637bb2 Mon Sep 17 00:00:00 2001 From: Royce Remer Date: Tue, 29 Oct 2024 22:41:55 -0700 Subject: Add new [lfs_client].BATCH_SIZE and [server].LFS_MAX_BATCH_SIZE config settings. (#32307) This contains two backwards-compatible changes: * in the lfs http_client, the number of lfs oids requested per batch is loaded from lfs_client#BATCH_SIZE and defaulted to the previous value of 20 * in the lfs server/service, the max number of lfs oids allowed in a batch api request is loaded from server#LFS_MAX_BATCH_SIZE and defaults to 'nil' which equates to the previous behavior of 'infinite' This fixes #32306 --------- Signed-off-by: Royce Remer Co-authored-by: wxiaoguang --- services/lfs/server.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'services') diff --git a/services/lfs/server.go b/services/lfs/server.go index 751dac64a0..6932f839c7 100644 --- a/services/lfs/server.go +++ b/services/lfs/server.go @@ -179,6 +179,11 @@ func BatchHandler(ctx *context.Context) { return } + if setting.LFS.MaxBatchSize != 0 && len(br.Objects) > setting.LFS.MaxBatchSize { + writeStatus(ctx, http.StatusRequestEntityTooLarge) + return + } + contentStore := lfs_module.NewContentStore() var responseObjects []*lfs_module.ObjectResponse -- cgit v1.2.3