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

"Error starting import: an import is already running" even after import process is finished #1369

Closed
Arsenalist opened this issue Jun 12, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@Arsenalist
Copy link

Version:

  • listmonk:2.4
  • OS: Mac M1

I'm uploading to ListMonk using Node and even after I successfully call the import endpoint using Axios and all the records are written, the next time I call the API I get this error:

Error starting import: an import is already running

I have to make a DELETE call to /api/import/subscribers and only then can I upload again successfully.

@Arsenalist
Copy link
Author

Here is the code that I'm using to upload the file. This is pretty easily reproducible:

const json = JSON.stringify({delim: ',',  mode: "subscribe", lists: [listId], overwrite: true})
const form = new FormData()
form.append("params", json)
form.append("file", fs.createReadStream(uploadedCsvFile.path), {filename: "import.csv"})
await axios.post(url('/api/import/subscribers'), form, {auth})

@Arsenalist
Copy link
Author

More on this. This error happens even after I verify that the import has finished by calling /api/import/subscribers/logs which returns:

{
    "data": "2023/06/12 15:14:14 importer.go:162: processing 'import.csv'\n2023/06/12 15:14:14 importer.go:329: imported finished\n"
}

@knadh knadh added the enhancement New feature or request label Jun 14, 2023
@knadh knadh self-assigned this Jun 14, 2023
@knadh
Copy link
Owner

knadh commented Jun 14, 2023

The DELETE call was by design to retain the state of the last import so that it's visible on the import page until the admin comes and clears it manually. I'll explore separating the actual import session + state retention so that this explicit call isn't required.

@knadh knadh closed this as completed in 5b40461 Jun 24, 2023
@knadh
Copy link
Owner

knadh commented Jun 24, 2023

This behaviour is now changed. A new import request will now automatically clear a finished/stopped/failed state without having to send a DELETE request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants