@semiont/make-meaning 0.5.33 → 0.5.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { createServer } from 'http';
2
2
  import { HttpTransport } from '@semiont/http-transport';
3
3
  import { archivistContentReads } from '@semiont/content';
4
- import { replyChannelsFor, accessToken, EventBus, baseUrl as baseUrl$1, retryWithBackoff, isTransientFetchError, STARTUP_FETCH_RETRY, errField, deriveViews, resourceId, getResourceId, getResourceEntityTypes, annotationId, getTargetSource, getBodySource, getStorageUri, getPrimaryRepresentation, decodeRepresentation, getTargetSelector, getTextPositionSelector } from '@semiont/core';
4
+ import { replyChannelsFor, accessToken, EventBus, withDeadline, baseUrl as baseUrl$1, retryWithBackoff, isTransientFetchError, STARTUP_FETCH_RETRY, errField, deriveViews, resourceId, getResourceId, getResourceEntityTypes, annotationId, getTargetSource, getBodySource, getStorageUri, getPrimaryRepresentation, decodeRepresentation, getTargetSelector, getTextPositionSelector } from '@semiont/core';
5
5
  import { loadEnvironmentConfig, SemiontState } from '@semiont/core/node';
6
6
  import { FilesystemViewStorage } from '@semiont/event-sourcing';
7
7
  import { getGraphDatabase, compareByRecencyThenId } from '@semiont/graph';
@@ -11320,6 +11320,8 @@ function registerGatherSummaryHandler(eventBus, gatherer, parentLogger) {
11320
11320
  }
11321
11321
 
11322
11322
  // src/service.ts
11323
+ var STARTUP_CONNECT_TIMEOUT_MS = 6e4;
11324
+ var RESTART_HINT = "Exiting so the container restart policy can retry \u2014 it is normal for a dependency to be slow when every service restarts at once.";
11323
11325
  function assertMakeMeaningConfig(config2) {
11324
11326
  if (!config2.services?.graph) {
11325
11327
  throw new Error("services.graph is required for make-meaning service");
@@ -11415,18 +11417,34 @@ async function main() {
11415
11417
  logger.child({ component: "view-storage" })
11416
11418
  );
11417
11419
  logger.info("Connecting to graph database", { type: graphConfig.type });
11418
- const graphDb = await getGraphDatabase(graphConfig);
11420
+ const graphDb = await withDeadline(
11421
+ "Graph database",
11422
+ STARTUP_CONNECT_TIMEOUT_MS,
11423
+ () => getGraphDatabase(graphConfig),
11424
+ RESTART_HINT
11425
+ );
11419
11426
  const embeddingConfig = config.services.embedding;
11420
11427
  logger.info("Connecting to embedding provider", { type: embeddingConfig.type, model: embeddingConfig.model });
11421
- const embeddingProvider = await createEmbeddingProvider(embeddingConfig);
11428
+ const embeddingProvider = await withDeadline(
11429
+ "Embedding provider",
11430
+ STARTUP_CONNECT_TIMEOUT_MS,
11431
+ () => createEmbeddingProvider(embeddingConfig),
11432
+ RESTART_HINT
11433
+ );
11422
11434
  const vectorsConfig = config.services.vectors;
11423
11435
  logger.info("Connecting to vector store", { type: vectorsConfig.type });
11424
- const vectorStore = await createVectorStore({
11425
- type: vectorsConfig.type,
11426
- host: vectorsConfig.host,
11427
- port: vectorsConfig.port,
11428
- dimensions: () => embeddingProvider.dimensions()
11429
- });
11436
+ const vectorStore = await withDeadline(
11437
+ "Vector store",
11438
+ STARTUP_CONNECT_TIMEOUT_MS,
11439
+ (signal) => createVectorStore({
11440
+ signal,
11441
+ type: vectorsConfig.type,
11442
+ host: vectorsConfig.host,
11443
+ port: vectorsConfig.port,
11444
+ dimensions: () => embeddingProvider.dimensions()
11445
+ }),
11446
+ RESTART_HINT
11447
+ );
11430
11448
  const httpTransport = new HttpTransport({
11431
11449
  baseUrl: baseUrl$1(baseUrl),
11432
11450
  token$: tokenSubject,