be super verbose about time left in context during startup
@@ -622,6 +622,11 @@ func configureTLS(tlsConfig *tls.Config) {
// Make all necessary changes to the TLS configuration here.
}
+func timeTillDeadline(ctx context.Context) time.Duration {
+ dl, _ := ctx.Deadline()
+ return time.Until(dl)
+}
+
// As soon as server is initialized but not run yet, this function will be called.
// If you need to modify a config, store server instance to stop it individually later, this is the place.
// This function can be called multiple times, depending on the number of serving schemes.
@@ -642,10 +647,13 @@ func configureServer(s *http.Server, scheme, addr string) {
messaging = &messages.Messaging{}
appState.Messaging = messaging
+ messaging.InfoMessage(fmt.Sprintf("created the context, nothing done yet, time left is: %s", timeTillDeadline(ctx)))
+
// Load the config using the flags
serverConfig = &config.WeaviateConfig{}
appState.ServerConfig = serverConfig
err := serverConfig.LoadConfig(connectorOptionGroup, messaging)
+ messaging.InfoMessage(fmt.Sprintf("loaded the config, time left is: %s", timeTillDeadline(ctx)))
// Add properties to the config
serverConfig.Hostname = addr
@@ -657,11 +665,14 @@ func configureServer(s *http.Server, scheme, addr string) {
}
loadContextionary()
+ messaging.InfoMessage(fmt.Sprintf("loaded the contextionary, time left is: %s", timeTillDeadline(ctx)))
connectToNetwork()
+ messaging.InfoMessage(fmt.Sprintf("connected to network, time left is: %s", timeTillDeadline(ctx)))
// Connect to MQTT via Broker
weaviateBroker.ConnectToMqtt(serverConfig.Environment.Broker.Host, serverConfig.Environment.Broker.Port)
+ messaging.InfoMessage(fmt.Sprintf("connected to broker (do we still need this???), time left is: %s", timeTillDeadline(ctx)))
// Create the database connector usint the config
err, dbConnector := dblisting.NewConnector(serverConfig.Environment.Database.Name, serverConfig.Environment.Database.DatabaseConfig)
@@ -670,6 +681,8 @@ func configureServer(s *http.Server, scheme, addr string) {
messaging.ExitError(78, err.Error())
}
+ messaging.InfoMessage(fmt.Sprintf("created db connector, time left is: %s", timeTillDeadline(ctx)))
+
// parse config store URL
configStore, err := url.Parse(serverConfig.Environment.ConfigStore.URL)
if err != nil {
@@ -682,16 +695,21 @@ func configureServer(s *http.Server, scheme, addr string) {
log.Fatal(err)
}
+ messaging.InfoMessage(fmt.Sprintf("created an etcd client, time left is: %s", timeTillDeadline(ctx)))
+
s1, err := concurrency.NewSession(etcdClient)
if err != nil {
log.Fatal(err)
}
+ messaging.InfoMessage(fmt.Sprintf("created an etcd session, time left is: %s", timeTillDeadline(ctx)))
manager, err := etcdSchemaManager.New(ctx, etcdClient, dbConnector, network)
if err != nil {
messaging.ExitError(78, fmt.Sprintf("Could not initialize local database state: %v", err))
}
+ messaging.InfoMessage(fmt.Sprintf("initialized the schema, time left is: %s", timeTillDeadline(ctx)))
+
manager.RegisterSchemaUpdateCallback(updateSchemaCallback)
// initialize the contextinoary with the rawContextionary, it will get updated on each schema update
