diff options
author | 2017-12-05 17:12:45 +0100 | |
---|---|---|
committer | 2017-12-05 17:12:45 +0100 | |
commit | cf0f8b382001d14fbfecf04f8cd176f8dced0d52 (patch) | |
tree | ba4ef0bc5de1924c7a6fc558ada24588aa04aa41 /src/api | |
parent | Merge pull request #400 from meetfranz/feature/delete-account (diff) | |
download | ferdium-app-cf0f8b382001d14fbfecf04f8cd176f8dced0d52.tar.gz ferdium-app-cf0f8b382001d14fbfecf04f8cd176f8dced0d52.tar.zst ferdium-app-cf0f8b382001d14fbfecf04f8cd176f8dced0d52.zip |
Added debug info and sleep in between actions
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/server/ServerApi.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index 644bf20cd..edea991e2 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -12,6 +12,8 @@ import NewsModel from '../../models/News'; | |||
12 | import UserModel from '../../models/User'; | 12 | import UserModel from '../../models/User'; |
13 | import OrderModel from '../../models/Order'; | 13 | import OrderModel from '../../models/Order'; |
14 | 14 | ||
15 | import { sleep } from '../../helpers/async-helpers'; | ||
16 | |||
15 | import { API } from '../../environment'; | 17 | import { API } from '../../environment'; |
16 | 18 | ||
17 | import { | 19 | import { |
@@ -303,21 +305,36 @@ export default class ServerApi { | |||
303 | 305 | ||
304 | fs.ensureDirSync(recipeTempDirectory); | 306 | fs.ensureDirSync(recipeTempDirectory); |
305 | const res = await fetch(packageUrl); | 307 | const res = await fetch(packageUrl); |
308 | console.debug('Recipe downloaded', recipeId); | ||
306 | const buffer = await res.buffer(); | 309 | const buffer = await res.buffer(); |
307 | fs.writeFileSync(archivePath, buffer); | 310 | fs.writeFileSync(archivePath, buffer); |
311 | console.debug('Recipe written to filesystem', recipeId); | ||
312 | |||
313 | await sleep(10); | ||
308 | 314 | ||
309 | tar.x({ | 315 | await tar.x({ |
310 | file: archivePath, | 316 | file: archivePath, |
311 | cwd: recipeTempDirectory, | 317 | cwd: recipeTempDirectory, |
312 | sync: true, | 318 | preservePaths: true, |
319 | unlink: true, | ||
320 | onwarn: x => console.log('warn', recipeId, x), | ||
313 | }); | 321 | }); |
322 | console.debug('Recipe extracted to', recipeTempDirectory); | ||
323 | |||
324 | await sleep(10); | ||
314 | 325 | ||
315 | const { id } = fs.readJsonSync(path.join(recipeTempDirectory, 'package.json')); | 326 | const { id } = fs.readJsonSync(path.join(recipeTempDirectory, 'package.json')); |
316 | const recipeDirectory = path.join(recipesDirectory, id); | 327 | console.debug('Recipe config parsed', id); |
317 | 328 | ||
329 | const recipeDirectory = path.join(recipesDirectory, id); | ||
318 | fs.copySync(recipeTempDirectory, recipeDirectory); | 330 | fs.copySync(recipeTempDirectory, recipeDirectory); |
331 | console.debug('Recipe moved to', recipeDirectory); | ||
332 | |||
319 | fs.remove(recipeTempDirectory); | 333 | fs.remove(recipeTempDirectory); |
334 | console.debug('Recipe temp directory removed', recipeTempDirectory); | ||
335 | |||
320 | fs.remove(path.join(recipesDirectory, recipeId, 'recipe.tar.gz')); | 336 | fs.remove(path.join(recipesDirectory, recipeId, 'recipe.tar.gz')); |
337 | console.debug('Recipe tar.gz removed', path.join(recipesDirectory, recipeId, 'recipe.tar.gz')); | ||
321 | 338 | ||
322 | return id; | 339 | return id; |
323 | } catch (err) { | 340 | } catch (err) { |