Skip to content

Commit 1bec487

Browse files
CasLubbersAni1357
authored andcommitted
fix: remove all the db messages on the websocket (#712)
(cherry picked from commit 1749940)
1 parent 9dd9fd9 commit 1bec487

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

src/app.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { CleanOptions } from 'simple-git'
1414
import { default as Authz } from 'src/authz'
1515
import {
1616
authzMiddleware,
17-
DbMessage,
1817
errorMiddleware,
1918
getIo,
2019
getSessionStack,
@@ -80,9 +79,6 @@ const checkAgainstGitea = async () => {
8079
}
8180
// inflate new db
8281
await otomiStack.loadValues()
83-
const sha = await otomiStack.git.getCommitSha()
84-
const msg: DbMessage = { state: 'clean', editor: 'system', sha, reason: 'conflict' }
85-
getIo().emit('db', msg)
8682
}
8783
}
8884

src/git.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml'
2424
import { BASEURL } from './constants'
2525
import { GitPullError, HttpError, ValidationError } from './error'
26-
import { DbMessage, getIo } from './middleware'
2726
import { Core } from './otomi-models'
2827
import { FileMap, getFilePath, getResourceName, renderManifest, renderManifestForSecrets } from './repo'
2928
import { getSanitizedErrorMessage, removeBlankAttributes } from './utils'
@@ -394,10 +393,6 @@ export class Git {
394393
const eMessage = getSanitizedErrorMessage(e)
395394
debug('Could not pull from remote. Upstream commits? Marked db as corrupt.', eMessage)
396395
this.corrupt = true
397-
if (!skipMsg) {
398-
const msg: DbMessage = { editor: 'system', state: 'corrupt', reason: 'conflict' }
399-
getIo().emit('db', msg)
400-
}
401396
try {
402397
// Remove local changes so that no conflict can happen
403398
debug('Removing local changes.')
@@ -420,8 +415,6 @@ export class Git {
420415
throw new GitPullError('Failed to remove upstream commits!')
421416
}
422417
debug('Removed upstream commits!')
423-
const cleanMsg: DbMessage = { editor: 'system', state: 'clean', reason: 'restored' }
424-
getIo().emit('db', cleanMsg)
425418
this.corrupt = false
426419
}
427420
}

src/otomi-stack.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { cloneDeep, filter, isEmpty, map, mapValues, merge, omit, pick, set, uns
1111
import { getAppList, getAppSchema, getSpec } from 'src/app'
1212
import { AlreadyExists, HttpError, OtomiError, PublicUrlExists, ValidationError } from 'src/error'
1313
import getRepo, { Git } from 'src/git'
14-
import { cleanSession, DbMessage, getIo, getSessionStack } from 'src/middleware'
14+
import { cleanSession, getIo, getSessionStack } from 'src/middleware'
1515
import {
1616
AplBackupRequest,
1717
AplBackupResponse,
@@ -2002,8 +2002,6 @@ export default class OtomiStack {
20022002
const sha = await rootStack.git.getCommitSha()
20032003
this.emitPipelineStatus(sha)
20042004
} catch (e) {
2005-
const msg: DbMessage = { editor: 'system', state: 'corrupt', reason: 'deploy' }
2006-
getIo().emit('db', msg)
20072005
e.message = getSanitizedErrorMessage(e)
20082006
throw e
20092007
} finally {
@@ -2032,8 +2030,6 @@ export default class OtomiStack {
20322030
const sha = await rootStack.git.getCommitSha()
20332031
this.emitPipelineStatus(sha)
20342032
} catch (e) {
2035-
const msg: DbMessage = { editor: 'system', state: 'corrupt', reason: 'deploy' }
2036-
getIo().emit('db', msg)
20372033
e.message = getSanitizedErrorMessage(e)
20382034
throw e
20392035
} finally {
@@ -2072,8 +2068,6 @@ export default class OtomiStack {
20722068
const sha = await rootStack.git.getCommitSha()
20732069
this.emitPipelineStatus(sha)
20742070
} catch (e) {
2075-
const msg: DbMessage = { editor: 'system', state: 'corrupt', reason: 'deploy' }
2076-
getIo().emit('db', msg)
20772071
e.message = getSanitizedErrorMessage(e)
20782072
throw e
20792073
} finally {

0 commit comments

Comments
 (0)