Open Bug 1686873 Opened 5 years ago Updated 4 years ago

CalStorageCalendar should use transactions where possible

Categories

(Calendar :: Provider: Local Storage, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: lasana, Unassigned)

References

Details

In bug 1671051 I realized the modifyItem() of CalStorageCalendar first deletes data before making updates. This can be dangerous if we have abrupt exits, like the user closing the application or crash etc.

We should look into putting these operations in transactions so failure means the no data is changed.

See Also: → 1671051

I think it's just flushItem and setMetaData, everything else is already in a transaction on account of this.

The pattern is something like this:

this.mDB.beginTransaction();
try {
  …
  this.mDB.commitTransaction();
} catch (ex) {
  this.mDB.rollbackTransaction();
  throw ex;
}
Assignee: lasana → nobody
You need to log in before you can comment on or make changes to this bug.