Skip to content

Series import: downloaded file isn't get removed when exception happens #1259

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

Open
php-coder opened this issue Feb 18, 2020 · 2 comments
Open
Assignees
Labels
Milestone

Comments

@php-coder
Copy link
Owner

When import has failed (because of a seller wasn't specified: #1218), the downloaded file doesn't get removed:

r.m.web.feature.image.ImageServiceImpl   : Image info has been saved to database (ImageInfoDto(id=326, type=JPEG))
w.f.i.FilesystemImagePersistenceStrategy : Image data has been written into file /data/uploads/326.jpeg
r.m.web.feature.image.ImageServiceImpl   : Series #257: image #326 was added
r.m.w.feature.series.SeriesServiceImpl   : Series #257 has been created (AddSeriesDbDto(categoryId=1, countryId=36, quantity=18, perforated=true, michelPrice=null, scottPrice=null, yvertPrice=null, gibbonsPrice=null, solovyovPrice=null, zagorskiPrice=null, releaseDay=null, releaseMonth=null, releaseYear=1995))
org.eclipse.jetty.server.HttpChannel     : /series/import/request/49

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: Seller id must be non null
mystamps@my-stamps:~$ ll /data/uploads/326.jpeg
-rw-r--r-- 1 mystamps mystamps 83672 Feb 19 02:09 /data/uploads/326.jpeg
@php-coder php-coder added this to the 0.4.3 milestone Feb 18, 2020
@php-coder php-coder self-assigned this Feb 18, 2020
@php-coder
Copy link
Owner Author

It's not so easy as in order to remove an image we need to have its id and type and we don't have this information within SeriesImportServiceImpl.addSeries() method.

@php-coder
Copy link
Owner Author

One way is to modify SeriesServiceImpl.add() to not create an image and execute SeriesServiceImpl.addImageToSeries() manually in the end of SeriesImportServiceImpl.addSeries()

@php-coder php-coder modified the milestones: 0.4.3, 0.5, 0.4.4 Mar 13, 2020
@php-coder php-coder modified the milestones: 0.4.4, next May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant