Update previous hash during event tick + general refactoring

Currently `yz_events:sync_indexes` is called on every tick because the previous hash is not being updated. I noticed this when investigating #304.

* Sync indexes IFF full check or hash has changed.
* Fix off-by-one error in full check.
* Add `MAYBE` macro for tighter code.

This can be verified by using redbug to verify `sync_indexes` is called every 60 seconds.

```
> redbug:start("yz_events:sync_indexes -> return", [{time, 180000}]).
```