#elixir-lang - 02 July 2019
« Back 1 day Forward 1 day »
[13:48:27] jeregrine: ericmj you did a really good Job of explaining mint and your decisions in that devchat podcast.
[13:58:24] ericmj: https://devchat.tv/elixir-mix/emx-058-mint-library-with-eric-meadows-j%C3%B6nsson-andrea-leopardi/
[14:00:57] fyuuri: Hi :). Is there a reason why a Registry can not be registered at another Registry? Registries can only take atoms as names.
[14:36:02] gamache: fyuuri: it's because internally, Registry information is stored in ETS tables, and the name of the registry is used to identify the tables
[14:45:21] fyuuri: gamache: thank you :) Will I suffer from performance loss if I put all processes in one registry?
[14:46:19] fyuuri: I Have a supervision tree containing dynamic supervisors and thought of putting the children of each dynamic supervisor in a separate registry.
[14:49:17] gamache: Each registry is also a supervisor, so there is a potential impact of having so many processes starting and stopping that the supervisor can't keep up with its message log.... at least that is my guess
[14:54:09] benwilson512: fyuuri: you really just need one registry for all of those, registries are sharded, they'll handle the load fine
[14:54:10] fyuuri: So it makes sense to have a supervision tree and and a single registry to register all workers and supervisors in that tree?
[14:56:06] fyuuri: Just for my understanding: If I use a single registry, what is the advantage over just using :atoms as names? Is there more to than :atoms not being garbage collected?
[15:00:45] benwilson512: if you have a bunch of processes you want to name dynamically, you don't want to name them with atoms
[15:01:39] benwilson512: you can think of it like a KV store where a given KV pair is also linked to a process
[15:43:10] nickjj: with ecto, if you wanted a read-only attribute in a changeset that's only changeable for tests, what's the best way of going about that?
[15:43:25] nickjj: would you code a MIX_ENV check in your changeset to only cast that attrib for tests?
[16:04:22] Zarathu: if you want to pass it as a param to cast(), in your module def, you could: if Mix.env() === :test do; @fields ~w(ro_field)a; else; @fields ~w(other_field)a; end
[16:10:54] nickjj: yeah non-castable, but the thing that's read-only is very important so i'd like to test it when it's either X or Y -- but it needs to be castable in order to modify it for a test
[16:17:49] lucus16: Should mix.lock be committed for libraries? My understanding is that they should not be because non-libraries determine the versions of every transitive dependency themselves
[16:24:53] ericmj: lucus16: mix.lock is used by developers of the library – not consumers of the library
[21:52:19] tristanm_: josevalim: "using", neither. but I took erl_tidy out of otp to create 'rebar3 format' https://github.com/tsloughter/erl_tidy/
[21:56:44] tristanm_: josevalim: I never worked on it though, been trying ot get someone to pick it up and drive it forward and then we submit it back to OTP. I don't remember what is still missing/buggy
[22:00:07] hypercore: Ankhers: haven't really thought about it all that deeply, just want to create a commenting system for a community website
[22:00:48] hypercore: just the standard stuff, users can leave comments on a product page, can reply to other users' comments, etc
[22:02:06] josevalim: tristan__: but in a nutshell, i don't think we can remove syntax_tools out of otp, but i think we can shrink it
[22:04:09] tristanm_: josevalim: might be a good canidate for their first moving of some shit to hex and out of otp
[22:04:46] josevalim: tristan__: yeah, exactly. but it would even be better if they don't maintain it IMO
[22:04:51] ankhers: Okay. Then at the very least, you will need one table with id, user_id, assoc_id, parent_id and comment. Where assoc_id is the id of the thing you are commenting on.
[22:06:12] tristanm_: I just want someone to actually maintain it, hehe. we could use a working formatter
[22:10:07] hypercore: Ankhers: also, does it make sense to store a Notification (e.g. what you find on youtube or facebook) in the database, like you would a regular schema?
[22:11:13] hypercore: like if you get a comment on your channel, or a new video comes out from someone you're subscribed to, you get a notification
[23:21:34] Zarathu: i wouldn't check Mix.env() in the body of a function though. first because Mix isn't available in a compiled release, but also it's inefficient to keep checking it after the module has been compiled/loaded
[23:50:22] ankhers: hypercore: Sorry for the delay. I guess it really depends. I would probably just build the notification system into postgres, especially if you are not currently using anything else. Mainly because I have more experience with pg than anything else.
[23:53:07] rawtaz: Ankhers: would you use it as a message queue somehow or just poll the database for new notifications?
[23:54:21] ankhers: It depends on my requirements. If my application is mostly static, I would just query the database for new notifications on page reload. However, if it is very dynamic, I would probably use something that isn't pg.
[23:55:57] ankhers: At least for the notification part. I might still hold the actual comments in pg.
[23:56:15] ankhers: But Phoenix also makes it easy enough via channels to send notifications when things happen.