Answer the question
In order to leave comments, you need to log in
Should programming take into account the possibility of an emergency interruption of the script execution (for example, a power outage, a computer breakdown)?
For example, in JavaScript, two properties A and B are stored in localStorage, and it is important that both of them are saved.
localStorage.a = 'hello world';
// --------- Экстренный обрыв выполнения сценария! --------
localStorage.b = 'hello world';
Or is the probability of such events extremely small and should be neglected in order not to complicate the code?
Answer the question
In order to leave comments, you need to log in
See how critical it is. If the user as a result loses money or two hours of work or cannot log into his account, you need to think about how to ensure integrity when reading in such cases.
You need to be paranoid and bother in moderation.
The problem is that the failure of iron cannot be determined programmatically. No code will be written to errno and there will be no exceptions, so it's not easy to secure your code.
Some requirements must be established for the software that describe its safety and fault tolerance. It is quite possible that not the entire program should have such characteristics, but only some critical part of it. In this case, it is necessary to provide critical modules/sections with additional facilities, state saving, query execution in transactions, etc.
In your case, this is not so easy to achieve, because a failure during the creation of a backup will still lead to complete, total and irreversible ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question