Browser timeouts when importing
See original GitHub issueWe pushed lot’s of importer improvements in the last year. I think the performance of the 1.x importer decreased a little, because we refactored the importer code base, fixed bugs and added more features.
One last improvement for the 1.x importer is missing. If you import a large JSON file via the browser, it can happen that a browser or nginx default timeout kicks in too early. Even thought that the server should still finish the import in the background, we should improve this, because the user doesn’t really understand what’s going on.
I think it’s impossible to extend (?) default timeouts for all supported/used browsers and even if we could, there is still a web-server component, which could timeout the connection.
So @kevinansfield and I think that adding short polling for the db import will resolve this. I think therefor we need to do:
- Upload the import file, return uploaded file path
- Trigger import with file path, immediate response and run in background
- Get result (simply e.g.
/db/import/result
) - could simply returninProgress: true|false
and the import result with warnings and if it was imported or failed.
Triggering another import while one is active, should return an error. We can keep the import result in process, no need to persist it. If you restart Ghost while the import is running, the import won’t finish and nothing get’s changed in the database, because we run everything in a transaction. This is the easiest solution i can think of which should work.
NOTE: Currently, if you import a database, you are still able to send any GET/POST/… request to the Ghost API. This is not blocked/denied while the import is running. This is a different topic we might solve in the future. But actually unrelated to short polling.
@kevinansfield Leave any concerns/thoughts as comment 👍
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (9 by maintainers)
Top GitHub Comments
I have a ~700mb import from Wordpress. I increased timeouts in nginx and imported the file. The latest log I see is
Dec 01 11:30:08 localhost.localdomain node[812]: [2019-12-01 17:30:08] INFO "POST /ghost/api/v3/admin/db/" 200 67608ms
but now ghost is unresponsive. Is there some database migration happening in the background I have to wait for? I gave up on waiting the first time and tried to restart ghost but it never stopped.
Would be really nice to tackle this soon. The browser timeout sucks 🙊