Skip to content

Commit

Permalink
Server: keep exec history in-memory up-to MAX_EVENT_LIMIT
Browse files Browse the repository at this point in the history
  • Loading branch information
gokmen committed Nov 21, 2017
1 parent f93f1a2 commit 026b62b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MAX_QUERY_LIMIT, LOG_LEVEL } from './constants'
import { TYPES, MAX_EVENT_LIMIT, MAX_QUERY_LIMIT, LOG_LEVEL } from './constants'
import readline from 'readline'

function __share(target, name, method, as) {
Expand Down Expand Up @@ -76,7 +76,11 @@ export default class RopeApi {
return callback({ message: 'No kite available' })
}

this.notifyNodes('node.exec', { from: requester, to: kiteId, method })
this.addToExecHistory({
from: requester,
to: kiteId,
method,
})

this.ctx.connections
.get(kiteId)
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const AUTH_SERVER = process.env.AUTH_SERVER || 'https://rope.live'
export const MAX_QUERY_LIMIT = 200
export const MAX_EVENT_LIMIT = 200
export const BLACKLIST_LIMIT = 10
export const LOG_LEVEL = process.env.ROPE_DEBUG || 0
export const PORT = 3210
Expand Down
2 changes: 1 addition & 1 deletion src/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class RopeContext {
['node.added', new Set()],
['node.removed', new Set()],
])

this.execHistory = new Array()
this.blackListCandidates = new Object()
this.blackList = new Set()
}
Expand Down

0 comments on commit 026b62b

Please sign in to comment.