{"action":"created","issue":{"url":"https://api.github.com/repos/esl/MongooseIM/issues/1865","repository_url":"https://api.github.com/repos/esl/MongooseIM","labels_url":"https://api.github.com/repos/esl/MongooseIM/issues/1865/labels{/name}","comments_url":"https://api.github.com/repos/esl/MongooseIM/issues/1865/comments","events_url":"https://api.github.com/repos/esl/MongooseIM/issues/1865/events","html_url":"https://github.com/esl/MongooseIM/issues/1865","id":324537590,"node_id":"MDU6SXNzdWUzMjQ1Mzc1OTA=","number":1865,"title":"Introducing new hooking library","user":{"login":"Pouriya-Jahanbakhsh","id":20663776,"node_id":"MDQ6VXNlcjIwNjYzNzc2","avatar_url":"https://avatars3.githubusercontent.com/u/20663776?v=4","gravatar_id":"","url":"https://api.github.com/users/Pouriya-Jahanbakhsh","html_url":"https://github.com/Pouriya-Jahanbakhsh","followers_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/followers","following_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/following{/other_user}","gists_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/gists{/gist_id}","starred_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/subscriptions","organizations_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/orgs","repos_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/repos","events_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/events{/privacy}","received_events_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-05-18T20:11:37Z","updated_at":"2018-06-04T09:30:22Z","closed_at":null,"author_association":"NONE","body":"Hi. I just wrote new hooking library [**posthaste**](https://github.com/pouriya-jahanbakhsh/posthaste). It's API is more like `ejabberd_hooks` API and functionality. But in lookup operation (for large number of processes at the same time) it's about 3-5 times faster than ETS. Do you want to look at that or use that ? If yes, i can open a pr.\r\nthanks"},"comment":{"url":"https://api.github.com/repos/esl/MongooseIM/issues/comments/394292553","html_url":"https://github.com/esl/MongooseIM/issues/1865#issuecomment-394292553","issue_url":"https://api.github.com/repos/esl/MongooseIM/issues/1865","id":394292553,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDI5MjU1Mw==","user":{"login":"Pouriya-Jahanbakhsh","id":20663776,"node_id":"MDQ6VXNlcjIwNjYzNzc2","avatar_url":"https://avatars3.githubusercontent.com/u/20663776?v=4","gravatar_id":"","url":"https://api.github.com/users/Pouriya-Jahanbakhsh","html_url":"https://github.com/Pouriya-Jahanbakhsh","followers_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/followers","following_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/following{/other_user}","gists_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/gists{/gist_id}","starred_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/subscriptions","organizations_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/orgs","repos_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/repos","events_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/events{/privacy}","received_events_url":"https://api.github.com/users/Pouriya-Jahanbakhsh/received_events","type":"User","site_admin":false},"created_at":"2018-06-04T09:30:22Z","updated_at":"2018-06-04T09:30:22Z","author_association":"NONE","body":"Hi @arcusfelis.\r\n\r\n> There are systems that use A LOT of virtual hosts.  \r\n\r\nIn `posthaste` A LOT of vhs means A LOT of function clauses for a hook. I think Erlang does binary search for this (Not sure). Suppose you have a `user_send_packet` hook registered with 3 vhs, in `posthaste` you will have:  \r\n```erlang\r\nuser_send_packet(VH1) ->\r\n    [{Priority, {Mod, Func}}, ...];\r\nuser_send_packet(VH2) ->\r\n    [{Priority, {Mod, Func}}, ...];\r\nuser_send_packet(VH3) ->\r\n    [{Priority, {Mod, Func}}, ...];\r\nuser_send_packet(_) ->\r\n    [].\r\n```\r\n\r\n> Sometimes mongooseim application start can be a performance issue, because we need to compile all these backend modules.  \r\n\r\nPosthaste provides a feature for this. in start phase you can call `posthaste:keep(PostHasteProc)` and it will kepp all requests. After adding all hooks, call `posthaste:dump(PostHasteProc)` and it will compile all requests one time.  \r\n\r\n> 2. General thing about code:purge. code_server broadcasts a message ...  \r\n\r\nIn posthaste each handler process will unload its hook module in terminate callback of gen_server. In MongooseIM i think it does this in stop phase. (Am i right?).\r\n\r\n\r\n"}}
{"actor":{"display_login":"Pouriya-Jahanbakhsh"}}