Skip to content

Commit 812f7ba

Browse files
committed
Temporarily disabled timeout for agent-to-agent connection
1 parent 18a65ea commit 812f7ba

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

agent/mesh.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@ export default function (rootDir, listen, config, onConfigUpdate) {
824824

825825
var toRemoteApp = (ep, provider, app, isDedicated, connectOptions) => pipeline($=>$
826826
.onStart(() => {
827+
$lastDataTime = {}
827828
$selectedEp = ep
828829
return selectHub(ep).then(hub => {
829830
$selectedHub = hub
@@ -832,7 +833,7 @@ export default function (rootDir, listen, config, onConfigUpdate) {
832833
})
833834
.pipe(() => $selectedHub ? 'proxy' : 'deny', {
834835
'proxy': ($=>$
835-
.handleData(() => { $lastReceivedTime = Date.now() })
836+
.handleData(() => { $lastDataTime.value = Date.now() })
836837
.connectHTTPTunnel(() => {
837838
var q = `?src=${config.agent.id}`
838839
if (isDedicated) q += '&dedicated'
@@ -846,11 +847,12 @@ export default function (rootDir, listen, config, onConfigUpdate) {
846847
ping: () => new Timeout(10).wait().then(new Data),
847848
}).to($=>$
848849
.connectTLS(tlsOptions).to($=>$
849-
.insert(() => checkTimeout())
850+
// .insert(() => checkTimeout()) // TODO: Enable session timeout
850851
.connect(() => $selectedHub, connectOptions)
851852
)
852853
)
853854
)
855+
.handleData(() => { $lastDataTime.value = Date.now() })
854856
),
855857
'deny': ($=>$
856858
.onStart(() => logError(`No route to endpoint ${ep}`))
@@ -859,10 +861,10 @@ export default function (rootDir, listen, config, onConfigUpdate) {
859861
})
860862
)
861863

862-
var $lastReceivedTime = 0
864+
var $lastDataTime = null
863865

864866
function checkTimeout() {
865-
if (Date.now() - $lastReceivedTime > 60000) {
867+
if (Date.now() - $lastDataTime.value > 60000) {
866868
return new StreamEnd
867869
} else {
868870
return new Timeout(10).wait().then(checkTimeout)

0 commit comments

Comments
 (0)