gocardless / statesman

A statesmanlike state machine library.
https://gocardless.com/blog/statesman/
MIT License
1.78k stars 163 forks source link

Make sure `nil` is accepted as cached value #505

Closed zerc closed 1 year ago

zerc commented 1 year ago

Context

If there are no previous transitions then nil will be returned and it should be cached. Otherwise, during the initial transition multiple database queries will be made to get the last transition (which doesn't exist).

See https://github.com/gocardless/statesman/issues/504 for more details

Tabby commented 1 year ago

Can you please add a test case that fails without this PR and passes with?

I can't see how this makes any meaningful difference in behaviour

zerc commented 1 year ago

@Tabby I've added the test and some comments to clarify the problem.