Skip to content

Commit

Permalink
Resolved Windows Lingering OE Server
Browse files Browse the repository at this point in the history
- Pushed DataEditor object to VSCode context subscriptions stack.
- Fixed sending of a `serverStop` request when given a predicate.
Closes apache#1005
  • Loading branch information
stricklandrbls committed Apr 10, 2024
1 parent e0d4c65 commit 3154406
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/dataEditor/dataEditorClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ import { extractDaffodilEvent } from '../daffodilDebugger/daffodil'
import * as editor_config from './config'
import {
configureOmegaEditPort,
NoSessionsExist,
ServerInfo,
ServerStopPredicate,
} from './include/server/ServerInfo'
Expand Down Expand Up @@ -177,6 +176,7 @@ export class DataEditorClient implements vscode.Disposable {
await this.panel.webview.postMessage(forwardAs)
})
)
context.subscriptions.push(this)

this.svelteWebviewInitializer = new SvelteWebviewInitializer(context)
this.svelteWebviewInitializer.initialize(this.view, this.panel.webview)
Expand All @@ -195,7 +195,9 @@ export class DataEditorClient implements vscode.Disposable {

// destroy the session and remove it from the list of active sessions
removeActiveSession(await destroySession(this.omegaSessionId))
await serverStopIf(NoSessionsExist)
await serverStopIf(() => {
return activeSessions.length == 0
})
for (let i = 0; i < this.disposables.length; i++)
this.disposables[i].dispose()
}
Expand Down
10 changes: 2 additions & 8 deletions src/dataEditor/include/server/ServerInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import * as editor_config from '../../config'
import * as fs from 'fs'
import assert from 'assert'
import { IServerInfo, getSessionCount } from '@omega-edit/client'
import { IServerInfo } from '@omega-edit/client'

export class ServerInfo implements IServerInfo {
serverHostname: string = 'unknown'
Expand Down Expand Up @@ -53,10 +53,4 @@ export function configureOmegaEditPort(configVars: editor_config.Config): void {
assert(omegaEditPort !== 0, 'omegaEditPort is not set')
}
}
export type ServerStopPredicate = (context?: any) => Promise<boolean>
export const NoSessionsExist: ServerStopPredicate = (): Promise<boolean> => {
return new Promise(async (resolve) => {
const count = await getSessionCount()
resolve(count === 0)
})
}
export type ServerStopPredicate = (context?: any) => boolean

0 comments on commit 3154406

Please sign in to comment.