Skip to content

Commit

Permalink
Merge pull request #2779 from DivanteLtd/bugfix/2729
Browse files Browse the repository at this point in the history
Bugfix/2729
  • Loading branch information
pkarw committed Apr 24, 2019
2 parents 98e4368 + 76a7575 commit a42703e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Global config api path under `api.url` - @BartoszLiburski (#2622)
- Google Tag Manager integration - @talalus (#841)
- Portuguese (pt-PT) translation - @xlcnd (#2695)
- Added `syncTasks` cleanup, `elasticCacheQuota` lowered to 3096KB - @pkarw (#2729)

### Fixed
- Sidebar menu wasn't possible to scroll - @PanMisza (#2627)
Expand Down
2 changes: 1 addition & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dynamicConfigContinueOnError": false,
"dynamicConfigExclude": ["ssr", "storeViews", "entities", "localForage", "shipping", "boost", "query"],
"dynamicConfigInclude": [],
"elasticCacheQuota": 4096
"elasticCacheQuota": 3096
},
"seo": {
"useUrlDispatcher": true
Expand Down
8 changes: 2 additions & 6 deletions core/client-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,7 @@ const invokeClientEntry = async () => {
// event.data.config - configuration, endpoints etc
const storeView = currentStoreView()
const dbNamePrefix = storeView.storeCode ? storeView.storeCode + '-' : ''

const syncTaskCollection = new UniversalStorage(localForage.createInstance({
name: dbNamePrefix + 'shop',
storeName: 'syncTasks'
}))
const syncTaskCollection = Vue.prototype.$db.syncTaskCollection

const usersCollection = new UniversalStorage(localForage.createInstance({
name: (config.storeViews.commonCache ? '' : dbNamePrefix) + 'shop',
Expand Down Expand Up @@ -254,7 +250,7 @@ const invokeClientEntry = async () => {
mutex[id] = true // mark this task as being processed
fetchQueue.push(() => {
return execute(task, currentToken, currentCartId).then(executedTask => {
syncTaskCollection.setItem(executedTask.task_id.toString(), executedTask)
syncTaskCollection.removeItem(id) // remove successfully executed task from the queue
mutex[id] = false
}).catch(err => {
mutex[id] = false
Expand Down
8 changes: 1 addition & 7 deletions core/lib/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,7 @@ function execute (task) { // not offline task
/** Clear sync tasks that were not transmitted yet */
function clearNotTransmited () {
const storeView = currentStoreView()
const dbNamePrefix = storeView.storeCode ? storeView.storeCode + '-' : ''

const syncTaskCollection = new UniversalStorage(localForage.createInstance({
name: dbNamePrefix + 'shop',
storeName: 'syncTasks',
driver: localForage[rootStore.state.config.localForage.defaultDrivers['syncTasks']]
}))
const syncTaskCollection = Vue.prototype.$db.syncTaskCollection
syncTaskCollection.iterate((task, id, iterationNumber) => {
if (!task.transmited) {
syncTaskCollection.removeItem(id)
Expand Down

0 comments on commit a42703e

Please sign in to comment.