Super long saving time in backend
-
Hi, we do have the problem that any saving action in the backend takes about 30 seconds. We also find the error, mayby you can fix it in a future release? Problem is function prepareSlideData in admin/assets/dist/js/app.min.js In prepareSlideData you do ### prepareSlideData(data) { let slides = data.filter(input => input.name.startsWith('attachment')) let allSlides = [] let currentSlide = '' slides.forEach(slide => { // Grab the id from a string like "attachment[2069][]" let thisSlide = slide.name.match(/attachment\[([\s\S]*?)\]/)[1] currentSlide = (currentSlide != thisSlide) ? thisSlide : currentSlide if ('undefined' === typeof allSlides[currentSlide]) { allSlides[currentSlide] = [] } allSlides[currentSlide].push(slide) }) }, return allSlides.filter(val => val) // re-index ### We do have very high post ids (987484571 for example). This means that before allSlides.filter(val => val) the allSlides is an array with for example three items allSlides[987484571] = array allSlides[987484572] = array allSlides[987484573] = array When you use allSlides.filter it takes about 30 Seconds because of starting at index 1 an iterating ... I fixed it by do something like that prepareSlideData(data) { let slides = data.filter(input => input.name.startsWith('attachment')) let allSlides = [] let allSlidesIndex = [] let allSlidesFinal = [] let currentSlide = '' slides.forEach(slide => { // Grab the id from a string like "attachment[2069][]" let thisSlide = slide.name.match(/attachment\[([\s\S]*?)\]/)[1] currentSlide = (currentSlide != thisSlide) ? thisSlide : currentSlide if ('undefined' === typeof allSlides[currentSlide]) { allSlides[currentSlide] = [] allSlidesIndex.push(currentSlide) } allSlides[currentSlide].push(slide) }) allSlidesIndex.forEach(index => { allSlidesFinal.push(allSlides[index]) }) return allSlidesIndex }, can you test and implemnt this?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Super long saving time in backend’ is closed to new replies.