6 Matching Annotations
  1. Jul 2019
  2. Jan 2019
    1. 这样可以方便的进行单元测试,不需要模拟Api.fetch函数的具体返回结果。

      非模拟时,由redux-saga内部的调度器帮我们执行 next(在异步函数或副作用函数执行获得结果后);

      模拟时,由测试函数自己根据需要执行 next,所以说无需模拟 Api.fetch 函数的具体返回结果,从而为测试带来了方便

    1. 要注意的是,在saga模式中不能保证隔离性,因为没有锁住资源,其他事务依然可以覆盖或者影响当前事务。

      因为saga没有tcc的try阶段,try阶段要做的一件事就是锁住资源

    2. T1, T2, ..., Tj(失败), Tj(重试),..., Tn

      向后恢复:出错则撤销;

      向前恢复:出错则重试。

  3. Jul 2017
    1. a state machine or workflow. Trouble is, that's not what a Saga is. A Saga is a failure management pattern.

      Failure Management Pattern: good summary,

    2. Sagas come out of the realization that particularly long-lived transactions (originally even just inside databases), but also far distributed transactions across location and/or trust boundaries can't eaily be handled using the classic ACID model with 2-Phase commit and holding locks for the duration of the work. Instead, a Saga splits work into individual transactions whose effects can be, somehow, reversed after work has been performed and commited.

      focus on long-lived, far distributed transactions