Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Commit

Permalink
fix(customer-groups): wait for customer groups to be loaded before st…
Browse files Browse the repository at this point in the history
…arting to import
  • Loading branch information
philippspo committed May 4, 2016
1 parent 13f5320 commit 8819034
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/customer-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ export default class CustomerImport {

processStream (customers, next) {
// process batch
this.loadCustomerGroups()
return Promise.map(customers, (customer) => {
return this.importCustomer(customer)
return this.loadCustomerGroups()
.then(() => {
// customer groups are loaded now
return Promise.map(customers, (customer) => {
return this.importCustomer(customer)
})
})
.then(() => {
// call next for next batch
Expand Down

0 comments on commit 8819034

Please sign in to comment.