Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lots of supplies #20

Open
kawaii opened this issue Mar 5, 2019 · 1 comment
Open

Use lots of supplies #20

kawaii opened this issue Mar 5, 2019 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@kawaii
Copy link
Member

kawaii commented Mar 5, 2019

This might be a bad idea but we should experiment with it.

One model for the API to update itself would be to have all objects listen to the events supply on the API object and handle those events that are relevant to them. This is not terrible but it does mean discarding lots of things lots of times, since the majority of events will not be relevant to the listener.

The other model is to have the API re-despatch the event to those objects to which it is relevant, by means of a supply on each object that the object can listen to. Essentially, whenever we create an object by inflation, we create a supply on the object and attach it to the main event supply via some magic or other. waves hands

The difficulty might be in new objects that we POST in the first place. We would have to attach this supply after we learn that the new object was successfully created, so that the object updates itself in future.

It might also be difficult to handle a delete event properly so we may have to refactor a few things.

@kawaii
Copy link
Member Author

kawaii commented Mar 5, 2019

Certain objects could also have their own supplies if we were going to throw supplies around a lot.

  • Message could have a reaction supply
  • Channel could have a message supply
  • User could have a message supply
  • User could have a mentions supply

etc

@kawaii kawaii added enhancement New feature or request help wanted Extra attention is needed labels Mar 5, 2019
@kawaii kawaii added this to the 1.0 milestone Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant