forked from tangled.org/core
this repo has no description

spindle: allowing configuring queue size and max job count

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li ec3cf759 061435fe

verified
Changed files
+22 -1
nix
spindle
+16
nix/modules/spindle.nix
···
description = "DID of owner (required)";
};
+
maxJobCount = mkOption {
+
type = types.int;
+
default = 2;
+
example = 5;
+
description = "Maximum number of concurrent jobs to run";
+
};
+
+
queueSize = mkOption {
+
type = types.int;
+
default = 100;
+
example = 100;
+
description = "Maximum number of jobs queue up";
+
};
+
secrets = {
provider = mkOption {
type = types.str;
···
"SPINDLE_SERVER_JETSTREAM=${cfg.server.jetstreamEndpoint}"
"SPINDLE_SERVER_DEV=${lib.boolToString cfg.server.dev}"
"SPINDLE_SERVER_OWNER=${cfg.server.owner}"
+
"SPINDLE_SERVER_MAX_JOB_COUNT=${toString cfg.server.maxJobCount}"
+
"SPINDLE_SERVER_QUEUE_SIZE=${toString cfg.server.queueSize}"
"SPINDLE_SERVER_SECRETS_PROVIDER=${cfg.server.secrets.provider}"
"SPINDLE_SERVER_SECRETS_OPENBAO_PROXY_ADDR=${cfg.server.secrets.openbao.proxyAddr}"
"SPINDLE_SERVER_SECRETS_OPENBAO_MOUNT=${cfg.server.secrets.openbao.mount}"
+2
nix/vm.nix
···
hostname = "localhost:6555";
listenAddr = "0.0.0.0:6555";
dev = true;
+
queueSize = 100;
+
maxJobCount = 2;
secrets = {
provider = "sqlite";
};
+2
spindle/config/config.go
···
Owner string `env:"OWNER, required"`
Secrets Secrets `env:",prefix=SECRETS_"`
LogDir string `env:"LOG_DIR, default=/var/log/spindle"`
+
QueueSize int `env:"QUEUE_SIZE, default=100"`
+
MaxJobCount int `env:"MAX_JOB_COUNT, default=2"` // max number of jobs that run at a time
}
func (s Server) Did() syntax.DID {
+2 -1
spindle/server.go
···
return err
}
-
jq := queue.NewQueue(100, 5)
+
jq := queue.NewQueue(cfg.Server.QueueSize, cfg.Server.MaxJobCount)
+
logger.Info("initialized queue", "queueSize", cfg.Server.QueueSize, "numWorkers", cfg.Server.MaxJobCount)
collections := []string{
tangled.SpindleMemberNSID,