I am fixing a bug in a project. The existing way to handle the case is
described as below.
There are 2 threads, one uploads(ftp) an image to the file server, the other
thread persist other relative data into the database.
Bug: if ftp image process fails, the new data still is stored into the db,
or if the data is rolled back, the image is still transferred to the file
server.
It is obvious not correct, either of them fails, all fails.
Difficulty: since here are using 2 threads, each is responsible of doing its
separate process so that the whole job is not treated as a unit of work.
I don't think this is a proper design in terms of this work flow.
I wonder the feasibility of making this 2 process all fails or all succeed
in multi-threading environment. If it is feasible, does any one have any
idea of making 2 processes as an unit of work?
Thanks.