INNER CODE UNIT · JavaScript

Promise

riclolsen/json-scada · src/OPC-UA-Server/index.js:1031

    await new Promise((resolve) => setTimeout(resolve, 5000))

    // detect connection problems, if error will null the client to later reconnect
    if (clientMongo === undefined) {
      Log.log('Disconnected Mongodb!')
      clientMongo = null
    }
    if (clientMongo)
      if (!(await checkConnectedMongo(clientMongo))) {
        // not anymore connected, will retry
        Log.log('Disconnected Mongodb!')
        if (clientMongo) clientMongo.close()
        clientMongo = null
      }
    // if disconnected from mongo, shut down the OPC-UA server(s) so clients
    // are dropped and can reconnect once the database is available again
    if (!clientMongo) await shutdownServers()
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…