Skip to content

Commit

Permalink
Change LIMIT_RECORD_COUNT_PER_NAMESPACE to LIMIT_RECORD_COUNT_PER_MODULE
Browse files Browse the repository at this point in the history
  • Loading branch information
tjerman committed Jan 8, 2025
1 parent 7eb367a commit 6c60464
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,10 @@
# LIMIT_SYSTEM_USERS=<no value>

###############################################################################
# Maximum number of records per namespace
# Maximum number of records per module
# Type: int
# Default: <no value>
# LIMIT_RECORD_COUNT_PER_NAMESPACE=<no value>
# LIMIT_RECORD_COUNT_PER_MODULE=<no value>

###############################################################################
###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions server/app/options/limit.cue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ limit: schema.#optionsGroup & {
type: "int"
description: "Maximum number of valid (not deleted, not suspended) users"
}
record_count_per_namespace: {
record_count_per_module: {
type: "int"
description: "Maximum number of records per namespace"
description: "Maximum number of records per module"
}
}
title: "Limits"
Expand Down
2 changes: 1 addition & 1 deletion server/compose/service/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ func (svc record) checkLimit(ctx context.Context, m *types.Module) (err error) {
// get the number of records count for the namespace
recordsCount, err := dalutils.ComposeRecordsCount(ctx, svc.dal, m, types.RecordFilter{
NamespaceID: m.NamespaceID,
ModuleID: 0,
ModuleID: m.ID,
})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion server/compose/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func Initialize(ctx context.Context, log *zap.Logger, s store.Storer, c Config)
DefaultModule = Module(c.SchemaAltManager)

DefaultImportSession = ImportSession()
DefaultRecord = Record(RecordOptions{LimitRecords: c.Limit.RecordCountPerNamespace})
DefaultRecord = Record(RecordOptions{LimitRecords: c.Limit.RecordCountPerModule})
DefaultPage = Page()
DefaultPageLayout = PageLayout()
DefaultChart = Chart()
Expand Down
7 changes: 4 additions & 3 deletions server/federation/rest/sync_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package rest
import (
"context"
"fmt"
"github.com/cortezaproject/corteza/server/pkg/options"
"net/http"
"strings"
"time"

"github.com/cortezaproject/corteza/server/pkg/options"

cs "github.com/cortezaproject/corteza/server/compose/service"
ct "github.com/cortezaproject/corteza/server/compose/types"
"github.com/cortezaproject/corteza/server/federation/rest/request"
Expand Down Expand Up @@ -100,7 +101,7 @@ func (ctrl SyncData) ReadExposedAll(ctx context.Context, r *request.SyncDataRead

// todo - handle error properly
// @todo !!!
if list, _, err := (cs.Record(cs.RecordOptions{LimitRecords: ctrl.opts.RecordCountPerNamespace})).Find(ctx, rf); err != nil || len(list) == 0 {
if list, _, err := (cs.Record(cs.RecordOptions{LimitRecords: ctrl.opts.RecordCountPerModule})).Find(ctx, rf); err != nil || len(list) == 0 {
continue
}

Expand Down Expand Up @@ -228,7 +229,7 @@ func (ctrl SyncData) readExposed(ctx context.Context, r *request.SyncDataReadExp
}

// @todo !!!
list, f, err := (cs.Record(cs.RecordOptions{LimitRecords: ctrl.opts.RecordCountPerNamespace})).Find(ctx, f)
list, f, err := (cs.Record(cs.RecordOptions{LimitRecords: ctrl.opts.RecordCountPerModule})).Find(ctx, f)

if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions server/pkg/options/options.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6c60464

Please sign in to comment.