Skip to content

Commit

Permalink
fix(docz-core): remove data server cache 😕
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Aug 13, 2018
1 parent bdfbf0b commit 9683280
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/docz-core/src/DataServer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as fs from 'fs-extra'
import equal from 'fast-deep-equal'
import WS from 'ws'

import { touch } from './utils/fs'
Expand Down Expand Up @@ -34,12 +32,10 @@ export interface State {
export class DataServer {
private server?: WS.Server
private states: Set<State>
private cached: Record<string, any>
private state: Record<string, any>

constructor(server?: any, port?: number, host?: string) {
this.states = new Set()
this.cached = fs.readJsonSync(paths.db, { throws: false })
this.state = {}

if (server) {
Expand All @@ -64,9 +60,7 @@ export class DataServer {
)
)

if (!equal(this.cached, this.state)) {
await touch(paths.db, JSON.stringify(this.state, null, 2))
}
await touch(paths.db, JSON.stringify(this.state, null, 2))
}

public async listen(): Promise<void> {
Expand Down

0 comments on commit 9683280

Please sign in to comment.