{"action":"opened","issue":{"url":"https://api.github.com/repos/cujojs/wire/issues/177","labels_url":"https://api.github.com/repos/cujojs/wire/issues/177/labels{/name}","comments_url":"https://api.github.com/repos/cujojs/wire/issues/177/comments","events_url":"https://api.github.com/repos/cujojs/wire/issues/177/events","html_url":"https://github.com/cujojs/wire/issues/177","id":112252592,"number":177,"title":"Dependencies when destroying a context?","user":{"login":"billwolckenlmco","id":327744,"avatar_url":"https://avatars.githubusercontent.com/u/327744?v=3","gravatar_id":"","url":"https://api.github.com/users/billwolckenlmco","html_url":"https://github.com/billwolckenlmco","followers_url":"https://api.github.com/users/billwolckenlmco/followers","following_url":"https://api.github.com/users/billwolckenlmco/following{/other_user}","gists_url":"https://api.github.com/users/billwolckenlmco/gists{/gist_id}","starred_url":"https://api.github.com/users/billwolckenlmco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billwolckenlmco/subscriptions","organizations_url":"https://api.github.com/users/billwolckenlmco/orgs","repos_url":"https://api.github.com/users/billwolckenlmco/repos","events_url":"https://api.github.com/users/billwolckenlmco/events{/privacy}","received_events_url":"https://api.github.com/users/billwolckenlmco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-19T23:21:03Z","updated_at":"2015-10-19T23:21:03Z","closed_at":null,"body":"When a context is created, if component A depends on B, then B will be created before A.  Is there a way to insure that when a context is destroyed that the dependent is destroyed before the dependency - i.e. A is destroyed before B?\r\n\r\nThe behavior I'm seeing is the components are destroyed in the same order that they are created, which means that dependencies are destroyed before the components that use them.  Hence dependencies get ripped out from under the code that needs them.\r\n\r\nMy scenario is a component which writes status updates and a database component.  The status updater depends on the database, so the database gets created (and connected) before the status updater gets created, so the database is ready before any status updates get written.  But on destroy, the database gets destroyed (and the connection closed) before the status updater (since that's the order they were created), so the last status updates error out because the database has been torn down before the status updater has finished."}}