@@ -72,13 +72,8 @@ struct Args {
72
72
73
73
/// (Advanced) Tweak the maximum number of jobs to run for handling events and commands. Be
74
74
/// careful how you use this as it can affect performance
75
- #[ arg(
76
- short = 'j' ,
77
- long = "max-jobs" ,
78
- default_value = "256" ,
79
- env = "WADM_MAX_JOBS"
80
- ) ]
81
- max_jobs : usize ,
75
+ #[ arg( short = 'j' , long = "max-jobs" , env = "WADM_MAX_JOBS" ) ]
76
+ max_jobs : Option < usize > ,
82
77
83
78
/// The URL of the nats server you want to connect to
84
79
#[ arg(
@@ -193,6 +188,8 @@ async fn main() -> anyhow::Result<()> {
193
188
194
189
let manifest_storage = nats:: ensure_kv_bucket ( & context, args. manifest_bucket , 1 ) . await ?;
195
190
191
+ debug ! ( "Ensuring event stream" ) ;
192
+
196
193
let event_stream = nats:: ensure_stream (
197
194
& context,
198
195
EVENT_STREAM_NAME . to_owned ( ) ,
@@ -204,6 +201,8 @@ async fn main() -> anyhow::Result<()> {
204
201
)
205
202
. await ?;
206
203
204
+ debug ! ( "Ensuring command stream" ) ;
205
+
207
206
let command_stream = nats:: ensure_stream (
208
207
& context,
209
208
COMMAND_STREAM_NAME . to_owned ( ) ,
@@ -222,6 +221,8 @@ async fn main() -> anyhow::Result<()> {
222
221
( vec ! [ DEFAULT_EVENTS_TOPIC . to_owned( ) ] , MIRROR_STREAM_NAME )
223
222
} ;
224
223
224
+ debug ! ( "Ensuring mirror stream" ) ;
225
+
225
226
let mirror_stream = nats:: ensure_stream (
226
227
& context,
227
228
mirror_stream. to_owned ( ) ,
@@ -230,14 +231,20 @@ async fn main() -> anyhow::Result<()> {
230
231
)
231
232
. await ?;
232
233
234
+ debug ! ( "Ensuring notify stream" ) ;
235
+
233
236
let notify_stream = nats:: ensure_notify_stream (
234
237
& context,
235
238
NOTIFY_STREAM_NAME . to_owned ( ) ,
236
239
vec ! [ format!( "{WADM_NOTIFY_PREFIX}.*" ) ] ,
237
240
)
238
241
. await ?;
239
242
240
- let permit_pool = Arc :: new ( Semaphore :: new ( args. max_jobs ) ) ;
243
+ debug ! ( "Creating event consumer manager" ) ;
244
+
245
+ let permit_pool = Arc :: new ( Semaphore :: new (
246
+ args. max_jobs . unwrap_or ( Semaphore :: MAX_PERMITS ) ,
247
+ ) ) ;
241
248
let event_worker_creator = EventWorkerCreator {
242
249
state_store : state_storage. clone ( ) ,
243
250
manifest_store : manifest_storage. clone ( ) ,
@@ -254,6 +261,8 @@ async fn main() -> anyhow::Result<()> {
254
261
)
255
262
. await ;
256
263
264
+ debug ! ( "Creating command consumer manager" ) ;
265
+
257
266
let command_worker_creator = CommandWorkerCreator {
258
267
pool : connection_pool,
259
268
} ;
@@ -278,6 +287,8 @@ async fn main() -> anyhow::Result<()> {
278
287
279
288
let wadm_event_prefix = DEFAULT_WADM_EVENTS_TOPIC . trim_matches ( trimmer) ;
280
289
290
+ debug ! ( "Creating lattice observer" ) ;
291
+
281
292
let observer = observer:: Observer {
282
293
parser : LatticeIdParser :: new ( "wasmbus" , args. multitenant ) ,
283
294
command_manager : commands_manager,
@@ -289,6 +300,8 @@ async fn main() -> anyhow::Result<()> {
289
300
event_worker_creator,
290
301
} ;
291
302
303
+ debug ! ( "Subscribing to API topic" ) ;
304
+
292
305
let server = Server :: new (
293
306
manifest_storage,
294
307
client,
0 commit comments