internet4000 / radio4000

(deprecated) Radio4000 (v1); public media library system, calm, non-intrusive
https://v1.radio4000.com
GNU General Public License v3.0
46 stars 19 forks source link

Refactor away from async relationships #248

Open oskarrough opened 6 years ago

oskarrough commented 6 years ago

Normally channel.get('tracks') will get local properties off of objects. But in the case of an async relationship, it will also trigger network requests. We don't control when the data is fetched.

Currently most or all of our model relationships are marked as async.

Instead it is recommended to set async: false and explicitly load the data when we need it. More information here: https://embermap.com/notes/83-the-case-against-async-relationships.

As an example, going to /200ok will not fetch one channel, but 90. That is because channel.favorites is an async relationship. It will also load ~200 image models, because they are async, too. It works but it is slowing things down considerably. We are loading much more than we need.

Opening this issue so we won't forget to refactor one day.

oskarrough commented 6 years ago