Skip to content

Commit

Permalink
Merge branch 'beta' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Oct 14, 2023
2 parents 0c6b3ab + cf7ed6e commit 01d44a6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bundled-modules
Submodule bundled-modules updated 56 files
+4 −0 audiostrom-liveprofessor/.build-info
+22 −0 audiostrom-liveprofessor/companion/HELP.md
+1 −0 audiostrom-liveprofessor/companion/manifest.json
+2 −0 audiostrom-liveprofessor/main.js
+6 −0 audiostrom-liveprofessor/main.js.LICENSE.txt
+1 −0 audiostrom-liveprofessor/package.json
+4 −0 avocet-landscape/.build-info
+23 −0 avocet-landscape/companion/HELP.md
+1 −0 avocet-landscape/companion/manifest.json
+2 −0 avocet-landscape/main.js
+6 −0 avocet-landscape/main.js.LICENSE.txt
+1 −0 avocet-landscape/package.json
+4 −0 avstumpfl-pixera/.build-info
+36 −0 avstumpfl-pixera/companion/HELP.md
+1 −0 avstumpfl-pixera/companion/manifest.json
+2 −0 avstumpfl-pixera/main.js
+6 −0 avstumpfl-pixera/main.js.LICENSE.txt
+1 −0 avstumpfl-pixera/package.json
+3 −3 dataton-watchout/.build-info
+1 −1 dataton-watchout/companion/manifest.json
+1 −1 dataton-watchout/main.js
+1 −1 dataton-watchout/package.json
+3 −3 figure53-qlab-advance/.build-info
+4 −2 figure53-qlab-advance/companion/HELP.md
+1 −1 figure53-qlab-advance/companion/manifest.json
+1 −1 figure53-qlab-advance/main.js
+1 −1 figure53-qlab-advance/package.json
+3 −3 generic-mqtt/.build-info
+1 −1 generic-mqtt/companion/manifest.json
+1 −1 generic-mqtt/main.js
+1 −1 generic-mqtt/package.json
+3 −3 h2r-graphics/.build-info
+1 −1 h2r-graphics/companion/manifest.json
+1 −1 h2r-graphics/main.js
+1 −1 h2r-graphics/package.json
+3 −3 ptzoptics-visca/.build-info
+1 −1 ptzoptics-visca/companion/manifest.json
+1 −1 ptzoptics-visca/main.js
+1 −1 ptzoptics-visca/package.json
+3 −3 qsys-remote-control/.build-info
+1 −1 qsys-remote-control/companion/manifest.json
+1 −1 qsys-remote-control/main.js
+1 −1 qsys-remote-control/package.json
+3 −3 yamaha-rcp/.build-info
+35 −35 yamaha-rcp/CLQL Parameters-1.txt
+17 −17 yamaha-rcp/DM3 Parameters-1.txt
+157 −0 yamaha-rcp/DM7 Parameters-1.txt
+8 −0 yamaha-rcp/RIO Parameters-1.txt
+0 −394 yamaha-rcp/Rivage Parameters-2.txt
+193 −0 yamaha-rcp/Rivage Parameters-3.txt
+12 −12 yamaha-rcp/TF Parameters-1.txt
+6 −0 yamaha-rcp/TIO Parameters-1.txt
+4 −4 yamaha-rcp/companion/HELP.md
+1 −1 yamaha-rcp/companion/manifest.json
+1 −1 yamaha-rcp/main.js
+1 −1 yamaha-rcp/package.json
19 changes: 14 additions & 5 deletions lib/Controls/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ActionRecorder from './ActionRecorder.js'
import ControlTrigger from './ControlTypes/Triggers/Trigger.js'
import { nanoid } from 'nanoid'
import TriggerEvents from './TriggerEvents.js'
import debounceFn from 'debounce-fn'

export const TriggersListRoom = 'triggers:list'

Expand Down Expand Up @@ -87,13 +88,21 @@ class ControlsController extends CoreBase {
* Check the instance-status of every control
* @access public
*/
checkAllStatus() {
for (const control of this.#controls.values()) {
if (typeof control.checkButtonStatus === 'function') {
control.checkButtonStatus()
checkAllStatus = debounceFn(
() => {
for (const control of this.#controls.values()) {
if (typeof control.checkButtonStatus === 'function') {
control.checkButtonStatus()
}
}
},
{
before: false,
after: true,
wait: 100,
maxWait: 500,
}
}
)

/**
* Remove any tracked state for an instance
Expand Down
18 changes: 15 additions & 3 deletions lib/Instance/Host.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ModuleHost {
this.instanceStatus = instanceStatus

const cpuCount = os.cpus().length // An approximation
this.startQueue = new PQueue({ concurrency: cpuCount })
this.startQueue = new PQueue({ concurrency: Math.max(cpuCount - 1, 1) })

this.children = new Map()
}
Expand All @@ -52,11 +52,14 @@ class ModuleHost {
* Bind events/initialise a connected child process
* @param {?} child
*/
#listenToModuleSocket(child) {
#listenToModuleSocket(child, startupCompleted, startupFailed) {
const forceRestart = () => {
// Force restart the connection, as it failed to initialise and will be broken
child.restartCount++

// Report the failure
startupFailed(new Error('Restart forced'))

const sleepDuration = sleepStrategy(child.restartCount)
if (!child.crashed) {
child.crashed = setTimeout(() => {
Expand Down Expand Up @@ -148,6 +151,8 @@ class ModuleHost {
.then(() => {
child.restartCount = 0

startupCompleted()

// mark child as ready to receive
child.isReady = true

Expand Down Expand Up @@ -448,11 +453,18 @@ class ModuleHost {

child.monitor = monitor

this.#listenToModuleSocket(child)
const initialisedPromise = new Promise((resolve, reject) => {
this.#listenToModuleSocket(child, resolve, reject)
})

// Start the child
child.monitor.start()

// Wait for init to complete, or fail
await initialisedPromise
// Sleep for a tick
await new Promise((resolve) => setImmediate(resolve))

// TODO module-lib - timeout for first contact
} else {
this.logger.debug(`Attempting to start missing connection: "${connectionId}"`)
Expand Down
23 changes: 14 additions & 9 deletions lib/Instance/Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,22 @@ class SocketEventsHandler {
const allFeedbacks = this.#getAllFeedbackInstances()
const allActions = this.#getAllActionInstances()

const msg = await this.ipcWrapper.sendWithCb('init', {
label: config.label,
isFirstInit: config.isFirstInit,
config: config.config,
const msg = await this.ipcWrapper.sendWithCb(
'init',
{
label: config.label,
isFirstInit: config.isFirstInit,
config: config.config,

lastUpgradeIndex: config.lastUpgradeIndex,
lastUpgradeIndex: config.lastUpgradeIndex,

// Pass all actions and feedbacks for upgrading and initial subscribe calls
actions: allActions,
feedbacks: allFeedbacks,
})
// Pass all actions and feedbacks for upgrading and initial subscribe calls
actions: allActions,
feedbacks: allFeedbacks,
},
undefined,
10000 // Allow more time before timeout, as init is likely to have a lot to do or high cpu contention
)

// Save the resulting values
this.hasHttpHandler = !!msg.hasHttpHandler
Expand Down

0 comments on commit 01d44a6

Please sign in to comment.