# Proper way to monitor state changes of the records?

**URL:** <https://discuss.emberjs.com/t/proper-way-to-monitor-state-changes-of-the-records/10852>\
**Category:** Uncategorized\
**Created:** [June 5, 2016, 4:36pm UTC](https://discuss.emberjs.com/t/proper-way-to-monitor-state-changes-of-the-records/10852 "2016-06-05T16:36:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![v3ss0n](https://avatars.discourse-cdn.com/v4/letter/v/b77776/32.png) [@v3ss0n](https://discuss.emberjs.com/u/v3ss0n)\
**Post date:** [June 5, 2016, 4:36pm UTC](https://discuss.emberjs.com/t/proper-way-to-monitor-state-changes-of-the-records/10852/1 "2016-06-05T16:36:12Z")

</div>

I am using a service at the backend that push data to store in realtime, via EventSource . While `store.createRecord().save()` is pushing into backend , it conflicts with client side store , and it cause duplicated records. As suggested by ember community at slack , i check the state of isSaving at records array , to make sure it won’t conflict , and then push later when isSaving is false . So it pushes to client side store after data is saved properly. I use Ember.run.later with an interval to repeatedly check , but is there better way to do? like monitoring state change of `isSaving`?

services’s code (subscribe is eventsource subscriber)

```javascript
  start() {
    var unbind = subscribe('http://localhost:9999/updates', (data) => {
      var incoming = JSON.parse(data)
      var gid = incoming.id

      var curstore = this.get('store').peekAll('message')
      var checkSave = () => {
        if (this.get('store').peekAll('message').isAny("isSaving", true)) {
          Ember.run.later(() => {
            checkSave()
          }, 100)

        } else {
        this.get('store').pushPayload({
          'message': incoming
        }) }
      };

      checkSave()
    });
  },

```
