Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/2729 #2779

Merged
merged 2 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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