diff --git a/services/clsi/app/coffee/RequestParser.coffee b/services/clsi/app/coffee/RequestParser.coffee index fe22982fda..d2e67bca76 100644 --- a/services/clsi/app/coffee/RequestParser.coffee +++ b/services/clsi/app/coffee/RequestParser.coffee @@ -31,11 +31,11 @@ module.exports = RequestParser = response.check = @_parseAttribute "check", compile.options.check, type: "string" - response.incremental = @_parseAttribute "incremental", - compile.options.incremental, + response.syncType = @_parseAttribute "syncType", + compile.options.syncType, type: "string" - response.state = @_parseAttribute "state", - compile.options.state, + response.syncState = @_parseAttribute "syncState", + compile.options.syncState, type: "string" if response.timeout > RequestParser.MAX_TIMEOUT diff --git a/services/clsi/app/coffee/ResourceWriter.coffee b/services/clsi/app/coffee/ResourceWriter.coffee index a4ae42517e..fca2c43682 100644 --- a/services/clsi/app/coffee/ResourceWriter.coffee +++ b/services/clsi/app/coffee/ResourceWriter.coffee @@ -13,23 +13,23 @@ parallelFileDownloads = settings.parallelFileDownloads or 1 module.exports = ResourceWriter = syncResourcesToDisk: (request, basePath, callback = (error) ->) -> - if request.incremental? - ResourceWriter.checkState request.incremental, basePath, (error, ok) -> - logger.log state: request.state, result:ok, "checked state on incremental request" + if request.syncType? is "incremental" + ResourceWriter.checkSyncState request.syncState, basePath, (error, ok) -> + logger.log syncState: request.syncState, result:ok, "checked state on incremental request" return callback new Error("invalid state") if not ok ResourceWriter.saveIncrementalResourcesToDisk request.project_id, request.resources, basePath, callback else @saveAllResourcesToDisk request.project_id, request.resources, basePath, (error) -> return callback(error) if error? - ResourceWriter.storeState request.state, basePath, callback + ResourceWriter.storeSyncState request.syncState, basePath, callback - storeState: (state, basePath, callback) -> - logger.log state:state, basePath:basePath, "writing state" - fs.writeFile Path.join(basePath, ".resource-state"), state, {encoding: 'ascii'}, callback + storeSyncState: (state, basePath, callback) -> + logger.log state:state, basePath:basePath, "writing sync state" + fs.writeFile Path.join(basePath, ".resource-sync-state"), state, {encoding: 'ascii'}, callback - checkState: (state, basePath, callback) -> - fs.readFile Path.join(basePath, ".resource-state"), {encoding:'ascii'}, (err, oldState) -> - logger.log state:state, oldState: oldState, basePath:basePath, err:err, "checking state" + checkSyncState: (state, basePath, callback) -> + fs.readFile Path.join(basePath, ".resource-sync-state"), {encoding:'ascii'}, (err, oldState) -> + logger.log state:state, oldState: oldState, basePath:basePath, err:err, "checking sync state" if state is oldState return callback(null, true) else