+16
nix/modules/spindle.nix
+16
nix/modules/spindle.nix
···
55
55
description = "DID of owner (required)";
56
56
};
57
57
58
+
maxJobCount = mkOption {
59
+
type = types.int;
60
+
default = 2;
61
+
example = 5;
62
+
description = "Maximum number of concurrent jobs to run";
63
+
};
64
+
65
+
queueSize = mkOption {
66
+
type = types.int;
67
+
default = 100;
68
+
example = 100;
69
+
description = "Maximum number of jobs queue up";
70
+
};
71
+
58
72
secrets = {
59
73
provider = mkOption {
60
74
type = types.str;
···
108
122
"SPINDLE_SERVER_JETSTREAM=${cfg.server.jetstreamEndpoint}"
109
123
"SPINDLE_SERVER_DEV=${lib.boolToString cfg.server.dev}"
110
124
"SPINDLE_SERVER_OWNER=${cfg.server.owner}"
125
+
"SPINDLE_SERVER_MAX_JOB_COUNT=${toString cfg.server.maxJobCount}"
126
+
"SPINDLE_SERVER_QUEUE_SIZE=${toString cfg.server.queueSize}"
111
127
"SPINDLE_SERVER_SECRETS_PROVIDER=${cfg.server.secrets.provider}"
112
128
"SPINDLE_SERVER_SECRETS_OPENBAO_PROXY_ADDR=${cfg.server.secrets.openbao.proxyAddr}"
113
129
"SPINDLE_SERVER_SECRETS_OPENBAO_MOUNT=${cfg.server.secrets.openbao.mount}"
+2
nix/vm.nix
+2
nix/vm.nix
+2
spindle/config/config.go
+2
spindle/config/config.go
···
17
17
Owner string `env:"OWNER, required"`
18
18
Secrets Secrets `env:",prefix=SECRETS_"`
19
19
LogDir string `env:"LOG_DIR, default=/var/log/spindle"`
20
+
QueueSize int `env:"QUEUE_SIZE, default=100"`
21
+
MaxJobCount int `env:"MAX_JOB_COUNT, default=2"` // max number of jobs that run at a time
20
22
}
21
23
22
24
func (s Server) Did() syntax.DID {
+2
-1
spindle/server.go
+2
-1
spindle/server.go
···
100
100
return err
101
101
}
102
102
103
-
jq := queue.NewQueue(100, 5)
103
+
jq := queue.NewQueue(cfg.Server.QueueSize, cfg.Server.MaxJobCount)
104
+
logger.Info("initialized queue", "queueSize", cfg.Server.QueueSize, "numWorkers", cfg.Server.MaxJobCount)
104
105
105
106
collections := []string{
106
107
tangled.SpindleMemberNSID,