business scenario is as follows:
I provide a ws server A for client B to call. Each call, the client inserts a piece of data into the database tab and then submits it. My server An internally calls another server C, and passes this data to the server C. after a series of processing, the server C returns a state to A. if the state is a failure, the failure information is written into tab, and returned to client B. If an exception is returned, the tab, is also written and marked as failed and returned. When client B calls again, it will query the tab according to the called data and the returned status. If the failure message is empty, it will directly return "successful, no need to submit", then write the error message in tab and no longer continue the process; if it fails, repeat the above process and insert a new data.
the problem now is that when client B calls for the first time, server C times out. When the timeout information is not returned and written into tab, client B calls client An again with the same data. At this time, the error message recorded in tab is empty, so the return "has been successful and does not need to be submitted again". In fact, neither of these two commits successfully completed the process in C.
when describing the problem, an idea came to my mind, that is, when C returns success, it also writes a new column. In this way, when judging, if this column is empty, it means that this item has not been processed, and an error will be returned directly. Returns successful only if this column is recorded as successful. But this will have to move the production data. Do you have any good ideas?