Fixed issue #349 - ticket search cache issue.
This commit is contained in:
parent
307b9dc744
commit
909a01df07
2 changed files with 12 additions and 10 deletions
|
@ -1,6 +1,7 @@
|
|||
# Changes
|
||||
|
||||
## Zammad 1.1.0
|
||||
- 2016-04-11 Implemented issue#[349](https://github.com/zammad/zammad/issues/349) - ticket search cache issue.
|
||||
- 2016-10-28 Implemented issue#[317](https://github.com/zammad/zammad/issues/317) - Display origin url from tweet/facebook post in article view.
|
||||
|
||||
## Zammad 1.0.1
|
||||
|
|
|
@ -13,15 +13,16 @@ class _globalSearchSingleton extends Spine.Module
|
|||
@apiPath = App.Config.get('api_path')
|
||||
|
||||
execute: (params) ->
|
||||
query = params.query
|
||||
render = params.render
|
||||
limit = params.limit || 10
|
||||
query = params.query
|
||||
render = params.render
|
||||
limit = params.limit || 10
|
||||
cache_key = query + '_' + limit
|
||||
|
||||
# use cache for search result
|
||||
if @searchResultCache[query]
|
||||
render(@searchResultCache[query].result)
|
||||
currentTime = new Date
|
||||
return if @searchResultCache[query].limit is limit && @searchResultCache[query].time > currentTime.setSeconds(currentTime.getSeconds() - 20)
|
||||
currentTime = new Date
|
||||
if @searchResultCache[cache_key] && @searchResultCache[cache_key].time > currentTime.setSeconds(currentTime.getSeconds() - 20)
|
||||
render(@searchResultCache[cache_key].result)
|
||||
return
|
||||
|
||||
App.Ajax.request(
|
||||
id: 'search'
|
||||
|
@ -48,11 +49,11 @@ class _globalSearchSingleton extends Spine.Module
|
|||
App.Log.error('_globalSearchSingleton', "No such model App.#{item.type}")
|
||||
|
||||
diff = false
|
||||
if @searchResultCache[query]
|
||||
diff = difference(@searchResultCache[query].resultRaw, data.result)
|
||||
if @searchResultCache[cache_key]
|
||||
diff = difference(@searchResultCache[cache_key].resultRaw, data.result)
|
||||
|
||||
# cache search result
|
||||
@searchResultCache[query] =
|
||||
@searchResultCache[cache_key] =
|
||||
result: result
|
||||
resultRaw: data.result
|
||||
limit: limit
|
||||
|
|
Loading…
Reference in a new issue