<    April 2017    >
Su Mo Tu We Th Fr Sa  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 _2_8 29  
00:00 Guest_ joined
00:03 s` joined
00:03 NeverDie joined
00:04 griffinbyatt joined
00:07 codestorm joined
00:13 <iFire> fishcakez: is there a debug mode for db_connection
00:14 weaksauce joined
00:14 <iFire> I have no idea how to get to the state of Snappyex.Protocol.execute in https://gist.githubusercontent.com/fire/2009b0d409783a51482d8ec127f9835e/raw/9a8368fb004295d4ae5454ba6d30ae9acaf905e5/gistfile1.txt
00:20 am55 joined
00:20 jkreeftmeijer joined
00:22 srxa joined
00:23 edmz joined
00:33 nighty-- joined
00:38 kiltzman joined
00:48 smt_ joined
00:50 InternetFriend joined
00:51 chavito joined
00:58 <wwwd> I am following a tutorial and have a couple of tests that are failing. Wondering if anyone can tell me what I am doing wrong? The function under test is doin what I expect, but the test is complaining "Expected truthy, got nil". https://gist.github.com/anonymous/c3f8913e76ad6e0e2bf70530b8
00:58 <benwilson512> wwwd: that link gets me a page not found
01:00 <wwwd> Sorry about that. How about this one? https://gist.github.com/anonymous/f997fa6f08af72b1430eeaf452eb98c2
01:00 <wwwd> Also, why is the author using both the password and the password_confirmation in the setup?
01:02 codestorm joined
01:02 jerel joined
01:07 <wwwd> benwilson512: I may have just figured it out. When I say I am following a tutoiral what I mean is I am loosely following...In my user model I have " |> validate_required([:name_first, :name_last, :username, :password, :password_confirmation])" which includes two fields that he author does not use...specifically :name_first and :name_last. Do I need to include them in my test setup?
01:12 marcdel joined
01:13 <notriddle> Does this seem accurate? https://gist.github.com/notriddle/8d7ac70c2de87139398df9b19fe5ad0e
01:14 <wwwd> Nope! That doesn't seem to be the problem.
01:14 vendethiel joined
01:16 <benwilson512> notriddle: largely ok, there's a few issues though
01:16 <benwilson512> depending on how close of a comparison you want to make
01:16 <notriddle> Okay?
01:17 <benwilson512> well "configuration" is a bit unclear, are you talking about build / project configuration or application configuration or both?
01:18 <notriddle> Mostly build configuration. App configuration should go in a separate section, if I want to talk about it.
01:18 <benwilson512> gotcha ok, yeah mix.exs is fine then
01:18 sevenseacat joined
01:18 <benwilson512> what do you mean by "add-ons". mix archive.install is sort of for adding globally available elixir scripts, is that what cargo install does?
01:19 jschneck joined
01:19 marcdel joined
01:19 <benwilson512> the elixir OTP thing is a bit off. every mix project is an OTP application. Applications are a bundle of both code and processes
01:20 <benwilson512> you can choose whether to have a basic process tree or not via the --sup flag
01:20 <benwilson512> but they're all OTP apps
01:20 <notriddle> cargo install adds globally available rust executables, yes.
01:21 <benwilson512> ok
01:21 <benwilson512> "Apparently, Elixirists have such complicated build configuration that it's an Elixir app in and of itself."
01:21 <notriddle> I mostly meant "add-ons" as in "globally available commands that can be run with the package manager"
01:21 <benwilson512> you then show a mix file
01:21 <notriddle> Which is elixir code. :-)
01:21 <benwilson512> that's just an elixir module
01:21 jkreeftmeijer joined
01:21 <benwilson512> not an entire application
01:21 <benwilson512> the whole project is the applicatoin
01:22 <benwilson512> that module defines some information about the application, but it is not itself the application
01:22 <notriddle> Fair enough.
01:22 <benwilson512> all in all though seems like a good breakdown
01:22 <benwilson512> are you coming from the rust side of things or somewhere else?
01:22 srxa joined
01:23 <notriddle> I've been using Elixir for a few months, and Rust for more than a few years. So, I guess I'm coming "from the Rust side of things."
01:23 <benwilson512> gotcha
01:23 <benwilson512> I have a lot of respect for the rust build tooling, it's very easy to use
01:24 <benwilson512> particularly in comparison to other languages that inhabit the same level of "bare metalness"
01:24 craigger joined
01:24 <notriddle> There are a few spots where I prefer the way Mix does it, honestly.
01:24 cschneid_ joined
01:24 <benwilson512> like?
01:25 <notriddle> Being able to check out a project that uses Ecto and just run the Ecto commands is really nice, without having to separately install an ecto CLI thing.
01:25 <benwilson512> ah yeah, mix tasks are very handy
01:25 cschneid_ joined
01:27 cschneid_ joined
01:31 <wwwd> benwilson512: Did that new link work?
01:32 MarioBranco joined
01:39 tomterl joined
01:40 lexmag joined
01:42 Aguxez joined
01:43 <cmk_zzz> hm, phx.gen.schema doesn't seem to exist if I've created an app with phx.new.ecto
01:43 marcdel joined
01:48 steffkes joined
01:48 steffkes joined
01:48 maxbeizer joined
01:49 <cmk_zzz> which I guess make sense because phoenix is not a dependency in the app
01:54 edennis joined
01:56 codestorm joined
02:11 jmcintosh joined
02:20 sevenseacat joined
02:20 harfangk joined
02:21 codestorm joined
02:21 marcdel joined
02:22 nahtnam joined
02:33 raycoll joined
02:39 raycoll joined
02:51 InternetFriend joined
02:54 nomicflux joined
02:55 <cmk_zzz> so I want to run some ExUnit tests. I've created an umbrella app with: mix new project --umbrella and then my business logic app inside "project/apps" with: mix phx.new.ecto. I've then created a test under test/myapp/test_thing.exs. When I run $ mix test it says "No tests to run"
02:56 <cmk_zzz> In mix.exs I found defp elixirc_paths(:test) and I added test/myapp to that list but it didn't help
02:56 <cmk_zzz> if I run $ mix test/myapp/test_thing.exs it successfully runs the test
03:02 Peregrine_ joined
03:08 jerel joined
03:15 vendethiel joined
03:22 jkreeftmeijer joined
03:25 srxa_ joined
03:30 jmcintosh joined
03:30 codestorm777 joined
03:35 raycoll joined
03:43 racycle joined
03:45 akeating joined
03:46 amosbird joined
03:48 gvaughn joined
03:48 steffkes joined
03:48 steffkes joined
03:50 ignacio_ joined
03:52 InternetFriend joined
03:54 codestorm joined
03:55 edennis joined
03:58 milad joined
03:58 amosbird joined
03:58 codestorm777 joined
03:59 refriedchicken joined
04:03 ivan_ joined
04:06 hahuang62 joined
04:08 foli_ joined
04:09 Synecy^ joined
04:09 levicole_ joined
04:09 larshesel_ joined
04:10 mozzarella joined
04:13 ciawal joined
04:14 nox joined
04:16 gvaughn joined
04:18 m1dnight_ joined
04:20 dignifiedquire joined
04:20 <alisdair> thing_test.exs
04:21 <alisdair> i think `*_test.exs` is mandatory
04:21 griffinbyatt joined
04:21 griffinbyatt joined
04:24 jkreeftmeijer joined
04:30 jerel joined
04:32 smt joined
04:54 srxa joined
04:56 edennis joined
05:07 bkparso joined
05:11 gvaughn joined
05:15 dec0n joined
05:21 kansi joined
05:22 bionj joined
05:23 griffinbyatt joined
05:44 edennis joined
05:49 steffkes joined
05:49 steffkes joined
05:54 meandi_2 joined
05:59 imack joined
06:05 gvaughn joined
06:07 craigp joined
06:14 jkreeftmeijer joined
06:15 sevenseacat joined
06:17 storban joined
06:20 MaSven joined
06:24 griffinbyatt joined
06:25 jimt joined
06:26 l14n joined
06:34 robinsjdotcom joined
06:41 josevalim joined
06:44 dani0_ joined
06:49 bionj joined
06:59 gvaughn joined
06:59 tuacker joined
07:02 dani0_ joined
07:02 proteusguy joined
07:03 odogono joined
07:04 acscherp joined
07:05 InternetFriend joined
07:06 manukall joined
07:08 steffkes joined
07:08 steffkes joined
07:09 voltone joined
07:11 Guest67_ joined
07:13 squallstter joined
07:15 flaviodesousa joined
07:20 m00dy joined
07:20 cemilowski joined
07:21 m00dy joined
07:22 mattyw joined
07:23 m00dy joined
07:23 edennis joined
07:25 griffinbyatt joined
07:26 cemilowski left
07:26 nd__ joined
07:27 robinsjdotcom joined
07:27 Guest67_ joined
07:28 mark_66 joined
07:42 dastagg joined
07:43 <m00dy> good morning people
07:44 srxa_ joined
07:45 vmoravec joined
07:46 lexmag joined
07:46 <Nicd-> hello m00dy!
07:47 inoas joined
07:50 tuacker1 joined
07:53 gvaughn joined
07:53 akeating joined
08:00 dani0_ joined
08:01 jadlr joined
08:05 eldritchideen joined
08:06 robinsjdotcom joined
08:09 srxa joined
08:12 jkreeftm_ joined
08:14 mattyw joined
08:14 colrack joined
08:14 milad joined
08:17 marr joined
08:20 stephen_m joined
08:24 prose[m] left
08:26 griffinbyatt joined
08:37 pc_ joined
08:40 <cmk_zzz> can someone explain how exunit finds tests? I followed the elixir-lang to create the KV application. And in there they put tests in test/kv/ directory. However when I try this on another application I've made mix test can't find tests in subdirectories of the test dir
08:42 pc_ left
08:45 <Havvy> I think it's test/**/*_test.exs
08:45 srxa joined
08:46 lexmag joined
08:47 <gazler> Mix is the project management and build tool for Elixir. Invoking mix test from the command line will run the tests in each file matching the pattern *_test.exs found in the test directory of your project.
08:47 <gazler> From https://hexdocs.pm/ex_unit/ExUnit.html#module-integration-with-mix
08:47 gvaughn joined
08:48 <cmk_zzz> thanks guys. I read that documentation several times. Still I didn't pick up that my test files where of format test_*.exs and not *_test.exs. Man I am getting old :/
08:49 <gazler> cmk_zzz: I have done _test.ex more times than I care to admit
08:50 <gazler> Had the CI missing the tests for ages before noticing.
08:50 srxa joined
08:50 <cmk_zzz> gazler: please say you are young and sharp so I don't have to feel bad
08:50 <cmk_zzz> ;)
08:51 <gazler> I used to be!
08:54 aep joined
08:57 aep left
09:04 _2easy joined
09:04 _2easy joined
09:11 <sevenseacat> what now? all of my test files are _test.exs
09:12 <sevenseacat> oh wait, i misread your statement :D
09:12 <sevenseacat> was quite confused for a moment there
09:12 <cmk_zzz> it is tricky. I know from own experience
09:13 <cmk_zzz> anyway, ecto cleans up the tables after the test but it doesn't reset sequences. Is this expected?
09:14 lexmag joined
09:26 griffinbyatt joined
09:27 duane joined
09:33 duane joined
09:33 josevalim joined
09:39 craigp joined
09:41 gvaughn joined
09:42 jkreeftmeijer joined
09:46 m00dy joined
09:50 m00dy joined
09:50 <ericmj> @cmk_zzz yes, sequences are not transactional
09:50 jkreeftm_ joined
09:50 hipertracker joined
09:53 robinsjdotcom joined
09:53 proteusguy joined
09:55 robinsjdotcom joined
10:05 edennis joined
10:16 gmcabrita joined
10:18 nbg joined
10:22 milad joined
10:27 griffinbyatt joined
10:34 jkreeftmeijer joined
10:35 gvaughn joined
10:39 m00dy joined
10:41 m00dy joined
10:42 m00dy joined
10:43 vendethiel- joined
10:44 m00dy joined
10:51 greengriminal joined
10:55 m00dy joined
10:56 inoas joined
10:58 cemilowski joined
11:04 griffinbyatt joined
11:05 cemilowski joined
11:07 InternetFriend joined
11:10 jkreeftmeijer joined
11:12 cevado joined
11:19 greengriminal joined
11:20 greengriminal joined
11:21 cemilowski joined
11:21 milad joined
11:26 gregman_ joined
11:28 rodolfojcj joined
11:29 gvaughn joined
11:34 pbogut joined
11:40 dignifiedquire joined
11:42 hipertracker joined
11:43 srxa joined
11:45 steffkes joined
11:45 steffkes joined
11:51 jschneck joined
11:52 jschneck joined
11:58 mark_66 joined
11:59 milad joined
12:01 bitmod joined
12:02 cemilowski joined
12:04 <bitmod> what's the reasoning behind putting app context files (e.g. blog.ex for the directory "blog" which contains [post.ex, comment.ex]) outside of their respective directories? i.e. why not move blog.ex into the "blog" direcotry and give it some constant name?
12:06 srxa_ joined
12:06 <benwilson512> bitmod: well for one thing that particular folder structure has been the standard in elixir for a very long time
12:06 <benwilson512> you have `my_app.ex` and `my_app` the folder inside of of which go files namespaced under `MyApp`
12:06 jkreeftmeijer joined
12:07 <bitmod> benwilson512: isn't this structure new? (coming with phoenix 1.3)
12:08 <benwilson512> bitmod: what's new is applying this pattern to how you organize your ecto schemas
12:08 <benwilson512> not the file and folder naming convention
12:09 <benwilson512> projects using phoenix did not always follow this broader naming convention, and now they will
12:09 jerel joined
12:10 <benwilson512> ericmj: finally using embedded schemas with ecto, this is looking very nice
12:11 <benwilson512> I'm actually getting mileage out of the cast / put assoc functions
12:11 <benwilson512> what I'm a bit unclear on is if put_assoc is supposed to be used for parent associations or not
12:11 <ericmj> benwilson512: awesome, micmus worked on all that :)
12:11 <benwilson512> oh cool
12:11 <benwilson512> micmus: great stuff!
12:12 <josevalim> bitmod: it is going to be inside in the next rc because it is easier to find files that way
12:12 <josevalim> but Elixir does not care about how your files are organized
12:12 <benwilson512> I've got a child changeset I"m working on and a parent_id column, should I be `|> put_assoc(:parent, Map.get(params, :parent))
12:13 <bitmod> josevalim: oh, nice. maybe it's a subjective thing, but it does appear to be a neater solution
12:13 <bitmod> josevalim: will it still retain the same name? e.g. blog/blog.ex
12:13 milad joined
12:14 <josevalim> yes
12:17 <micmus> benwilson512: put_assoc expects structured arguments
12:17 <hmans> I love you josevalim
12:17 <micmus> vs cast_assoc expecing params
12:18 <micmus> this is a similar difference than change vs cast for regular fields
12:18 <benwilson512> micmus: right, I'm surmising I don't want cast_assoc in this case cause I'm not trying to change the parent, so running a changeset function on the parent is undesirable
12:18 <benwilson512> I'm just trying to avoid having `parent_id` in the cast list
12:19 <benwilson512> what is the correct way to validate the requiredness of having the parent set?
12:19 <benwilson512> put_assoc and then validate required on parent_id ?
12:20 acscherp joined
12:21 <micmus> AFAIK - put_assoc won't modify parent_id until repo
12:21 <micmus> if you only allow setting the parent by reference, setting the id is the best approach, I think
12:22 <benwilson512> micmus: so the issue with setting the id is that a while back I had a function that took two parents, and then set the ids on a changeset
12:22 <benwilson512> except when I called the function I put the parents in the wrong order
12:22 <benwilson512> foreign key constraints didn't help me because both tables actually had those ids
12:23 <benwilson512> now obviously I could pattern match in the function head for the struct types or something
12:23 <micmus> put_assoc wouldn't help, though. I don't think we verify it's the correct struct
12:23 <benwilson512> but I feel like since the schema already knows what each association type should be, and what keys to use
12:23 <benwilson512> ah
12:23 <benwilson512> ok
12:23 nighty-- joined
12:23 <benwilson512> I'm gonna play around with changeset helpers then for this and see if I can distill something that may be generally useful
12:24 gvaughn joined
12:26 edennis joined
12:29 dimitarvp joined
12:40 cristianR_ joined
12:40 m00dy joined
12:44 sevenseacat joined
12:44 m00dy joined
12:54 steffkes joined
12:54 steffkes joined
12:57 dani0_ joined
13:01 robinsjdotcom joined
13:04 ikcerog joined
13:05 akeating joined
13:06 fmcgeough joined
13:06 robertc left
13:10 <m00dy> Hi Nicd-
13:11 <Nicd-> how are you doing today?
13:11 <Nicd-> fine sunny day here
13:17 ZippoWeb joined
13:17 srxa joined
13:17 m00dy joined
13:19 jschneck joined
13:21 gvaughn joined
13:22 sfbw joined
13:26 m00dy joined
13:27 milad joined
13:28 m00dy joined
13:29 smt_ joined
13:33 dani0_ joined
13:39 milad joined
13:41 maxbeizer joined
13:42 odogono_ joined
13:48 dani0_ joined
13:52 InternetFriend joined
13:58 ariejan joined
14:01 <benwilson512> blah, my build server isn't compiling the nif for eiconv properly :(
14:02 akeating joined
14:02 <benwilson512> other nifs seem fine, comeonin has its nif in _build/prod/lib/comeonin/priv/ where you'd expect
14:02 <benwilson512> but _build/prod/lib/eiconv/ just has ebin and mix.rebar.config
14:04 k77 joined
14:06 liveforeverx joined
14:06 chops joined
14:07 chrismccord joined
14:08 jkreeftmeijer joined
14:08 miwa_ joined
14:09 gvaughn joined
14:09 pantech_ joined
14:09 gvaughn joined
14:10 antipax_ joined
14:11 ericmj_ joined
14:12 milad joined
14:12 lopex joined
14:13 marceldegraaf joined
14:13 smt joined
14:14 c-rack_ joined
14:14 zeeshanlakhani joined
14:15 andersh joined
14:15 klaus_trainer joined
14:15 folz joined
14:15 mojinations joined
14:15 likestoplay joined
14:15 kblake joined
14:15 lancetw joined
14:16 HashNuke joined
14:16 davisp joined
14:17 bcardarella joined
14:18 Havvy joined
14:18 cemilowski left
14:18 Hibame joined
14:18 chavito joined
14:22 cschnei__ joined
14:22 m00dy joined
14:24 robinsjdotcom joined
14:26 mark_661 joined
14:27 racycle joined
14:27 m00dy joined
14:29 m00dy joined
14:29 dani0_ joined
14:30 griffinbyatt joined
14:31 jkreeftmeijer joined
14:32 m00dy joined
14:32 gvaughn joined
14:33 <iFire> fishcakez: Any idea what this blob is? %Ecto.Query.SelectExpr{expr: {:&, [], [0]},
14:33 <iFire> fields: [{:&, [], [0, [:id, :randomnumber], 2]}],
14:33 <iFire> In particular I don't know if fields is valid.
14:34 <iFire> %Query{select: %{fields: fields}} = query <-
14:34 robinsjdotcom joined
14:35 ikcerog joined
14:36 keathley joined
14:40 laut joined
14:41 proteusguy joined
14:41 ignacio_ joined
14:43 benwilson512 joined
14:43 <benwilson512> the whole gen_smtp/mimemail/iconv space is such a shitshow
14:44 <benwilson512> gen_smtp is on hex which is nice, but it needs iconv as a dependency and doesn't say so in the readme, nor list it as an actual dependency.
14:44 <benwilson512> the iconv that is on hex however is not compatible
14:44 <benwilson512> Mailman lists a github dependency but it's been deprecated for like a year
14:44 <benwilson512> and is the one that won't compile its nif on ubuntu properly
14:44 <sevenseacat> :/
14:46 <fishcakez> iFire: I dont do much work on the DSL sorry, dont know
14:47 <iFire> yeah it's basically gibberish to me :(
14:47 <iFire> So I can't tell if [0, [:id, :randomnumber], 2] is a valid args
14:47 <iFire> to
14:48 <iFire> https://github.com/elixir-ecto/ecto/blob/1bef8f044db1f05b14ab0dcfe360b01c3edadcec/lib/ecto/adapters/postgres/connection.ex#L888
14:49 <iFire> So the query is supposed to like select id, randomnumber from world where id = blah.
14:49 <iFire> where blah is a integer
14:56 jkreeftm_ joined
14:57 edennis joined
14:57 steffkes joined
14:57 kevwil joined
14:58 milad joined
15:02 gvaughn_ joined
15:05 craigp_ joined
15:05 potatosalad joined
15:06 uamana joined
15:07 kronicdeth joined
15:08 <benwilson512> blah both mailgun and mailman are effectively abandonware, weeeeee
15:09 <benwilson512> ah mailgun wont' actually do what I need anyway
15:09 <OliverMT> aws ses?
15:09 <benwilson512> I use SES for the actual sending
15:09 <OliverMT> mailchimp for templates and ses for delivery, been happy with that
15:09 <benwilson512> but I was using mailman to render the raw email
15:09 <OliverMT> ah
15:09 <OliverMT> I can vouch for bamboo
15:09 <benwilson512> does mailchimp do attachments?
15:09 <OliverMT> or rather haste can, he set it up
15:10 <OliverMT> we just used gen_smtp before bamboo
15:10 <* haste> vouches for bamboo.
15:10 <haste> we're still using gen_smtp for attachments
15:10 <OliverMT> hah, there you go
15:10 <OliverMT> :D
15:10 <benwilson512> haste: heh
15:10 <haste> there's a PR up on bamboo, but it's stuck in limbo it seems
15:10 <OliverMT> gen_smtp pretty solid btw
15:10 <benwilson512> attachments are like 99% of what we use emails for sadly
15:11 <OliverMT> easy to set up and use
15:11 <benwilson512> OliverMT: sorta, it has a dependency on iconv that isn't listed on hex or the readme
15:11 <OliverMT> seems to be de facto standard on erlang
15:11 <OliverMT> tallak, a dude on the elixir slack has made a elixir only iconv replacement
15:11 <OliverMT> that we use for it
15:11 <benwilson512> it's in the rebar config as https://github.com/zotonic/eiconv but I can't get that to build its nif properly on ubuntu for some reason
15:11 <OliverMT> the iconv stuff is 99% for inbound email
15:11 <benwilson512> OliverMT: that's what I need :(
15:11 <benwilson512> we have very ghetto customers who like to email us stuff
15:11 <OliverMT> ok, why are you doing inbound on your own
15:12 <OliverMT> ses -> s3
15:12 <benwilson512> well it comes in from AWS
15:12 <benwilson512> yup
15:12 <OliverMT> then lambda a REST call to your api or just use sqs
15:12 <benwilson512> I pull the raw email from SES and need to parse out attachments
15:12 <OliverMT> or rather SNS into an sqs
15:12 m00dy joined
15:12 <benwilson512> that's exactly what I do, but that doesn't get me around parsing attachments from a raw email body
15:12 <OliverMT> I used javascript for the parsing
15:12 <benwilson512> ah
15:12 <OliverMT> there are several battle tested libs
15:13 <benwilson512> yeah I mean this was working fine till I tried to move to OTP 19
15:13 <OliverMT> met some bugs, but gen_smtp wasnt even remotely close to being able to parse those either
15:13 <benwilson512> which is when eiconv broke
15:13 <OliverMT> look into codepagex
15:13 <benwilson512> what JS lib do you use?
15:13 <OliverMT> you need to do some mapping
15:13 <OliverMT> dont know, its not in versioning, since we abandoned it shortly after
15:13 <OliverMT> just made poc
15:13 <OliverMT> then we swapped our angle of attack away from parsing .ics
15:13 <OliverMT> it was a system to put call setup info automatically into propagated outlook invites
15:14 <benwilson512> blah. just frustrated, this was supposed to be a small upgrade and now I'm looking at re-writing our entire incoming mail system
15:14 <OliverMT> so much random parse breakage from weirdo clients not doing the right thing
15:14 <OliverMT> the one I found have like 10k stars on github
15:14 <OliverMT> is usaully a good indicator
15:14 <benwilson512> and it still had issues?
15:14 <benwilson512> best I can tell parsing incoming mail is a nightmare
15:14 <OliverMT> of course, email is satan himself :D
15:14 hipertracker joined
15:14 <OliverMT> you need to fuzz so much crap
15:15 <OliverMT> because clients send stuff out of rfc
15:15 <OliverMT> missing double \r\n etc between headers and body and such weird stuff
15:15 <OliverMT> outlook is the worst of the worst
15:16 acscherp joined
15:16 <mrx1> OliverMT: but for the user it's best of best ;]
15:16 <OliverMT> I got outlook licence, still vastly prefer google inbox :p
15:17 <mrx1> i prefer outlook very strongly, just better user experience imho
15:17 cschneid_ joined
15:17 <mrx1> and nice calendar integrantion, sending meetings by e-mail, which are added to your calendar etc.
15:18 hipertracker joined
15:22 cdg joined
15:23 dsimon joined
15:24 <nyaray> google does that pretty well, too. I remember when I got invitations for interviews from recruiters and other Serious People™ that use outlook and google would just ask if I wanted to add it to my calendar
15:26 <OliverMT> you obviously dont handle the amount of mail I deal with :P
15:26 m00dy joined
15:26 <OliverMT> the way google inbox works with postponing mail, making it pop back out with a notification at a given time, the way you mark stuff as done and whatnot is so much better
15:27 <OliverMT> I do fully agree that the meeting invites in google look shit
15:27 <OliverMT> compared to outlooks invites, but technologically they are fully equivalent
15:27 <OliverMT> the google calendar integrates better to your phone imo
15:28 <OliverMT> the underlaying ics structure for meeting requests in outlook and inviting people from calendar are identical
15:28 <OliverMT> (I know, because that was what we were parsing to augment :P)
15:30 griffinbyatt joined
15:31 alisdair joined
15:34 imack joined
15:34 jkreeftmeijer joined
15:34 imack joined
15:35 imack joined
15:35 dsimon joined
15:36 imack joined
15:36 imack joined
15:37 imack joined
15:37 tuacker joined
15:39 Nvm joined
15:39 <Nvm> http://www.ngdevelopers.net/downloads/
15:41 JEG2 joined
15:42 MaSven joined
15:46 bionj joined
15:51 <nox> OliverMT: Meetings are bad anyway. :P
15:53 davidw joined
15:55 milad joined
15:59 amclain joined
16:00 amclain joined
16:01 cevado joined
16:01 <iFire> fishcakez: I got past that problem \o/
16:04 kblake joined
16:08 duane joined
16:09 gvaughn joined
16:09 wsieroci joined
16:10 racycle joined
16:10 gvaughn_ joined
16:12 cristianR_ joined
16:12 lexmag joined
16:14 CStorm joined
16:17 hipertracker joined
16:22 aeliton joined
16:29 m00dy joined
16:30 m00dy joined
16:34 m00dy joined
16:34 storban joined
16:35 cevado joined
16:36 keathley joined
16:37 <benwilson512> josevalim: hey sorry to bother you, I'm trying to figure out if this is an elixir problem or not
16:38 <josevalim> sure
16:38 <benwilson512> but having quite a bit of trouble creating a reproducible example
16:38 <benwilson512> I'm getting
16:38 <benwilson512> https://www.irccloud.com/pastebin/GzCfSStT/
16:38 <benwilson512> when trying to use the {:eiconv, github: "zotonic/eiconv"} dependency
16:38 <benwilson512> BUT only in my main project, not in a separate example project
16:38 <benwilson512> I've done the usual things
16:39 <benwilson512> nuked _build and deps
16:39 <benwilson512> made sure the elixir versions are the same (1.4.2, OTP 19.2)
16:39 <josevalim> hrm, this is familiar
16:39 <benwilson512> there aren't any .beam files laying around root
16:40 <benwilson512> I have confirmed that _build/dev/lib/eiconv does not contain priv
16:40 acscherp joined
16:40 <josevalim> benwilson512: does it work on some machines but not in others?
16:40 jkreeftmeijer joined
16:40 <josevalim> or does it always fail?
16:40 <benwilson512> it used to work on this machine, and then it broke in prod when I updated some stuff, and now it doesn't work on this machine either
16:40 <benwilson512> let me try an older elixir version real quick
16:40 jkreeftmeijer joined
16:41 <josevalim> well, not having something in priv is definitely part of the issue
16:41 smt joined
16:41 <benwilson512> it shows correctly in deps though
16:42 <josevalim> it doesn't matter, it needs to be copied to _build
16:42 <josevalim> you need to find out why it is not being copied
16:43 <benwilson512> right yeah, not sure where to begin on that
16:43 <benwilson512> trying to make a reproducible example
16:43 <josevalim> when you try to reproduce it, it just works?
16:43 <benwilson512> yes
16:43 <benwilson512> however
16:44 <benwilson512> in the main project where it fails
16:44 <benwilson512> it works in elixir 1.3.4
16:44 <benwilson512> but not in 1.4.2
16:44 <benwilson512> without any other changes
16:44 <josevalim> benwilson512: it is definitely rebar related
16:44 <josevalim> then
16:44 <acscherp> this is with eiconv as dep from gen_smtp?
16:44 <josevalim> mix deps | grep "eiconv"
16:45 <benwilson512> acscherp: yes
16:45 <benwilson512> * eiconv 1.1 (https://github.com/zotonic/eiconv.git) (rebar3)
16:45 <josevalim> {:eiconv, github: "zotonic/eiconv", manager: :rebar, override: true}
16:45 <josevalim> do that in your root
16:46 <josevalim> benwilson512: can you reproduce the issue if you use eiconv through a dependency instead of directly?
16:46 <benwilson512> josevalim: it's a git dep, so it isn't possible to use indirectly
16:46 <josevalim> oh
16:46 <josevalim> ok, i know which issue it is
16:46 <acscherp> how do you refer gen_smtp? not from hex?
16:46 <benwilson512> acscherp: I use hex for gen_smtp
16:47 <josevalim> benwilson512: https://github.com/elixir-lang/elixir/issues/5830
16:47 <josevalim> I think it is this issue
16:47 <josevalim> let me know if forcing manager: :rebar fixes it
16:47 <benwilson512> ok one sec
16:48 <benwilson512> recompiling everything on 1.4.2
16:49 <benwilson512> ah wtf it works now
16:49 <benwilson512> at least locally
16:50 <benwilson512> i'll try the manager: :rebar thing and see if that fixes prod
16:50 raycoll joined
16:51 squallstter joined
16:53 marcdel joined
16:54 refriedchicken joined
16:54 smt joined
17:00 cristianR_ joined
17:03 ariejan joined
17:08 akeating joined
17:08 cevado joined
17:09 Guest67 joined
17:10 frefity joined
17:16 wsieroci joined
17:25 m00dy joined
17:26 greengriminal joined
17:26 musicnode joined
17:27 m00dy joined
17:28 m00dy joined
17:28 craigp joined
17:28 robinsjdotcom joined
17:28 acscherp joined
17:29 hahuang65 joined
17:30 myronmarston joined
17:30 imush joined
17:32 griffinbyatt joined
17:33 uamana joined
17:34 craigp joined
17:35 <myronmarston> I’m trying to use `Module.get_attribute` in a macro outside `quote` but can’t get it to work.
17:35 kblake joined
17:36 kblake joined
17:37 <myronmarston> https://gist.github.com/myronmarston/f8cf2872351fb28e9d59cee9b8cd98a4 shows a simplified example of what I’m trying to do
17:37 <myronmarston> Any ideas why `Module.get_attribute/2` outside of `quote` always returns `nil`
17:38 akeating joined
17:40 kronicdeth joined
17:44 dsimon joined
17:47 jkreeftmeijer joined
17:48 hahuang61 joined
17:49 InternetFriend joined
17:49 maxbeizer joined
17:57 ZippoWeb joined
18:01 kblake joined
18:04 manukall joined
18:04 musicnode joined
18:07 craigp joined
18:11 rodolfojcj joined
18:13 <Ioyrie> can you not pass the attribute directly?
18:14 bionj_ joined
18:17 meh` joined
18:20 refriedchicken joined
18:22 fowlduck joined
18:23 moistoreos joined
18:24 <myronmarston> Not really. In practice I’m doing something a bit like ExUnit tests where module attributes are used before a function definition to declare some metadata about the function, and my macro is an overridden `def` that uses the module atttribute, the delegates to `Kernel.def`
18:24 <myronmarston> more than anything I’d lke to understand why that doesn’t work
18:27 refriedchicken66 joined
18:27 kblake_ joined
18:29 hbraun joined
18:30 greengriminal joined
18:31 <z1mvader> hey guys! I'm using alchemist but i cannot access to the erlang functions' docs
18:32 <z1mvader> its telling me that :erlang was not compiled with docs, how can I archieve that?
18:33 griffinbyatt joined
18:39 wsieroci joined
18:41 MotherFlojo joined
18:43 akeating joined
18:51 <OliverMT> recompile erlang with docs or install package with docs
18:51 <OliverMT> z1mvader: ^
18:51 <OliverMT> I think the erlang solutions one are including documentation, but tbh not sure
18:53 <z1mvader> my package manager has an erlang-docs package
18:53 <z1mvader> that should be enough?
18:54 <OliverMT> most likely :)
18:54 <OliverMT> or.. maybe not
18:54 <z1mvader> lol
18:54 <z1mvader> let me check
18:54 <OliverMT> dont know how it works on linux :P
18:54 <OliverMT> I code in windows
18:54 <OliverMT> and previously mac
18:57 <z1mvader> didnt work :(
18:58 <OliverMT> I think what you got was manpages maybe?
18:59 kyrix joined
19:01 dani0_ joined
19:03 MarioBranco joined
19:06 <z1mvader> nope
19:07 bitmod joined
19:07 srxa joined
19:07 <z1mvader> https://www.irccloud.com/pastebin/i4HDOiDM/
19:07 <bitmod> how does ecto query syntax work? is that a special DSL, or just regular elixir syntax?
19:08 hipertracker joined
19:15 kblake joined
19:18 jkreeftmeijer joined
19:19 <OliverMT> its dsl through elixir macros mapping more or less 1:1 with sql (or whatever db you are using)
19:20 <OliverMT> if you're on sql its best thought of as lightweight syntax sugar for sql
19:20 <OliverMT> its main purpose is to make binding to elixir variables easier and more explicit
19:21 <bitmod> OliverMT: so it's an extension of elixir syntax then?
19:22 <bitmod> i.e. i need to use the Ecto module to use it?
19:22 <OliverMT> extension of elixir syntax is the wrong way to word it
19:22 <OliverMT> its simply macros and functions built in elixir that maps your Ecto schemas to joins and helps make results bind to elixir variables
19:26 colrack joined
19:28 <bitmod> OliverMT: right... so how does elixir recognize it? do i have to do something explicit in order for that to happen?
19:28 <OliverMT> you import the files containing the macros
19:28 <OliverMT> thats about it
19:28 <bitmod> ah ok
19:30 <OliverMT> err sorry I mean import the modules
19:34 griffinbyatt joined
19:37 MaSven joined
19:41 hahuang61 joined
19:44 MarioBranco joined
19:45 <alisdair> bitmod: it's a dsl, yeah, but elixir has first class support for dsls
19:46 mattyw_ joined
19:50 <bitmod> DSLs, macros, metaprogramming, this stuff is confusin
19:50 <bitmod> confusing*
19:53 ikcerog joined
19:53 vmoravec joined
19:54 jkreeftmeijer joined
19:54 milad joined
19:58 marcdel joined
20:02 myronmarston joined
20:08 marcdel joined
20:11 griffinbyatt joined
20:13 icanhazbroccoli joined
20:17 bionj joined
20:20 cdg joined
20:23 chrismccord joined
20:23 musicnode joined
20:24 meh`_ joined
20:24 drincruz joined
20:26 josevalim_ joined
20:38 wsieroci joined
20:41 <benwilson512> bitmod: you may benefit from the meta-programming elixir book if you want to look into how it works
20:41 <bitmod> benwilson512: yeah that's on my reading list, after programming elixir and programming phoenix
20:41 <benwilson512> awesome
20:42 lexmag joined
20:44 akeating joined
20:47 rodolfojcj joined
20:48 acscherp joined
20:50 <bitmod> benwilson512: another questions i've got regarded function clauses, what order is recommend? should i put initial conditions first or final conditions first? (i.e. with a reducer, would i put reducer([]) first or last)
20:52 <OliverMT> the idiom in elixir is to have what you act upon as the first argument
20:52 <OliverMT> like the enum funcs have the enums as the first arg
20:52 <OliverMT> the reason behind this is that similar functions should be able to pipe chain
20:54 <benwilson512> patterns are matched from top to bottom
20:54 <benwilson512> which in many cases means final conditions MUST be first, or at least it's a lot more ergonomic to do so
20:55 <benwilson512> but yeah I'd say even when it can go either way, base cases first
20:55 <bitmod> benwilson512: so in this example i would put "def reduce(list) do..." first?
20:56 <bitmod> (as opposed to "def reduce([]) do ...")
20:56 <bitmod> or reduce([], sum) or wahtever it would be
20:56 truami joined
20:57 <* OliverMT> needs to read the question more carefully first
20:58 <bitmod> also base case refers to the result of the last process of a recursion, correct?
20:58 <OliverMT> if you dont put the [] case first you'll end up catching the [] case in the one that has "list" unless you have an additional guard on it
20:58 <edmz> is there a way to trace/introspect whatever is happening in cowboy?
20:58 <edmz> some requests are not hitting phoenix and are returning 505
20:58 <OliverMT> edmz: #ninenines good place for those questions if no one has the answer here
20:59 <edmz> OliverMT: thanks
20:59 <OliverMT> I just normally squiggle some runes on the ground and invoke the presence of gazler when I wonder about something in cowboy
20:59 guacamole joined
20:59 <* edmz> squiggles some runes on the ground
20:59 steffkes joined
21:01 <bitmod> benwilson512: sorry, could you clarify your statement?
21:01 <benwilson512> bitmod: `def reduce([item | rest])` would go after `def reduce([](`
21:01 refriedchicken joined
21:02 <bitmod> great, thanks
21:02 <benwilson512> you put terminating or final clauses first
21:02 <benwilson512> and then other clauses after
21:03 <bitmod> benwilson512: is there a reason http://elixir-lang.org/getting-started/recursion.html doesn't do this in every example?
21:08 <adamkittelson> how do you check which node a process is running in if you have its pid?
21:09 <OliverMT> Process.whereis
21:09 <OliverMT> I think
21:09 <adamkittelson> that let's you get the pid from its locally registered name
21:10 <adamkittelson> I'm looking for how to know which node a pid is running on, say if I know the pid after doing a lookup with :global.whereis_name
21:11 MarioBranco joined
21:12 griffinbyatt joined
21:13 <OliverMT> adamkittelson: node(pid)
21:13 <OliverMT> its a bif
21:13 <adamkittelson> thanks!
21:14 <benwilson512> bitmod: no idea, if I had to guess it's trying to illustrate the clause where you do something first since intro docs like this assume you've never seen elixir in your life
21:14 <benwilson512> or pattern matching for that matter
21:14 sfbw joined
21:14 <benwilson512> it's emphasizing the clause where stuff happens
21:14 <benwilson512> when you're actually in a recursive mindset though I tend to find that it works out best to emphasize the clauses where you're done first, and then you write what's left
21:17 MarioBranco joined
21:18 <OliverMT> pseudo code is idiomatic to have base case last
21:18 <OliverMT> discrete math books etc
21:18 <OliverMT> maybe thats why?
21:29 akeating joined
21:39 duane joined
21:42 milad joined
21:47 <nyaray> base case last also makes sense for performance reasons, since you only do the base case once, unless you're doing something special, allowing you to always take the first branch
21:48 <nyaray> but I don't know if all the dynamic dispatch stuff messes it up anyway
21:48 <benwilson512> from what I've heard the BEAM is pretty good about optimizing that kind of thing
21:49 <benwilson512> for some matches it isn't a linear search
21:49 <benwilson512> or even a log(n) tree, but rather an O(1) table
21:50 ignacio_ joined
21:52 <OliverMT> nyaray: I can gurantee you that the beam bytecode is not even remotely similar to how you define your defs
21:53 <OliverMT> if you dumb it down a lot, it basically translate to a huge case statement
21:53 <OliverMT> at least that is how I have had it explained
21:54 <nyaray> I'm not claiming any authority
21:54 duane_ joined
21:54 <nyaray> hadn't heard about the stuff your mentioning
21:55 <nyaray> man, I should just keep irc read-only after 23:00d
21:55 jkreeftmeijer joined
21:55 <nyaray> -d
21:56 <OliverMT> is there anything thats *not* dynamic dispatch in elixir? just since you specifically mentioned that
21:56 <OliverMT> :D
21:59 <* nyaray> remains quiet
21:59 <nyaray> it's after what should be my speaking curfew
21:59 <OliverMT> haha
21:59 <OliverMT> do you come from java?
21:59 <OliverMT> out of curiosity
22:00 <OliverMT> because dynamic dispatch was a huge discussion point in java8 when we got invokeDynamic
22:00 <OliverMT> to help the new languages like groovy and clojure along
22:00 <OliverMT> every single call on a class or object before that required an extra lookup to java.lang.Reflection before that
22:00 <OliverMT> to make sure the call was not npe'd
22:02 <nyaray> hm.. I'm back in java, I guess. I never did it professionally until now
22:03 <nyaray> well.. maybe a little, but not really enough for it to count
22:03 <nyaray> I'm kind of numbing myself with cynicism. java's so... not fun :|
22:04 <OliverMT> I came from years of java to elixir
22:04 <OliverMT> feels very good, the beam is a lot easier to reason about
22:04 <OliverMT> not to mention I dont have to ever run a servlet container again
22:08 <nyaray> :)
22:09 TheNet joined
22:11 <nyaray> well, bed time. good night!
22:12 <OliverMT> gntie!
22:12 <OliverMT> gnite
22:13 griffinbyatt joined
22:13 s` joined
22:15 rodolfojcj joined
22:16 josevalim joined
22:17 hahuang61 joined
22:18 <cmk_zzz> is it common in elixir to use "opaque" return data structures from modules? Like in erlang if you want to return a record from your API you usually provide functions to operate on the record so that you don't have problems updating the record structure later on. Would you do the same with structs in elixir?
22:20 <cmk_zzz> The reason I'm asking is because I return an ecto schema from a function and I don't like that I bleed implementation details out from the API. So instead should I document it as the function return an "opaque object" and provide functions to operate on it. It is more tedious (getters and setters and what not) but gives better encapsulatioin
22:20 hipertracker joined
22:26 <benwilson512> I'm not a big fan of "encapsulating" data behind functions in functional programming
22:26 <benwilson512> it's just data
22:27 <benwilson512> if you need to treat that data a particular way you pass it to functions that treat it that particular way
22:27 <benwilson512> if you need to treat it another way you pass it to functions that treat it some other way
22:27 <cmk_zzz> well, that is what encapsulating data is isn't it?
22:27 <edmz> I created a simple api with phoenix. Everything works fine except if I send two requests in a row. It seems to be choking at the cowboy level.
22:28 <edmz> I even created 2 requests with different ruby clients so as to make sure they were not caching or holding a connection
22:28 <benwilson512> cmk_zzz: what you were talking about seemed like you would mediate access to the data through setters and gettters
22:28 <benwilson512> I'm saying that whatever functions get the data get to just operate on the data
22:28 <benwilson512> without the indirection of setters and getters
22:28 <edmz> They still share the same request_id in phoenix
22:28 <edmz> https://gist.github.com/edmz/0d4cf0f970153ff6671d6beca30bf2b6
22:29 <benwilson512> edmz: so you've got a couple issues there
22:29 <cmk_zzz> benwilson512: well, if people operate directly on the data structure returned I can never change it. If it is map I can't change it to a hashtree or whatever
22:29 <benwilson512> edmz: Task.async links the new process to the process that started it
22:29 <benwilson512> and vice versa
22:30 <benwilson512> oh wait why are you doing async at all
22:30 <benwilson512> since you're just awaiting right after
22:30 <OliverMT> I think he is prototyping
22:30 <OliverMT> for a later thing
22:30 <benwilson512> gotcha
22:30 <edmz> benwilson512 : the way that I need the API to wok is like this:
22:31 <OliverMT> but why async at all, a process can just hang as long as you want waiting for remote work to happen
22:31 <edmz> if I can answer in less than N seconds, I return a final response. If not, I return a temp response but the work keeps going.
22:31 <benwilson512> cmk_zzz: ah I see what you're saying
22:31 <OliverMT> async is generally if you need to fork work to do it in parallelll
22:31 <benwilson512> there are definitely cases where encapsulation is useful
22:31 <benwilson512> take the :queue module for example
22:31 <benwilson512> the data itself is sort of an implementation detail
22:31 <OliverMT> ok, task async with a yield is not a bad idea for that
22:31 <benwilson512> there's a big issue for that
22:32 <benwilson512> the web process will exit
22:32 <benwilson512> or at least MAY exit
22:32 <benwilson512> after it returns a response
22:32 <benwilson512> which will kill the work
22:32 <benwilson512> because they're linked
22:32 <benwilson512> you should start the work under a supervisor
22:32 <benwilson512> with https://hexdocs.pm/elixir/Task.Supervisor.html#async_nolink/2
22:33 <benwilson512> cmk_zzz: Ecto schemas though are not I think an example of a datastructure where its contents are an implementation detail
22:33 duane joined
22:34 <benwilson512> or if you want to treat them that way
22:34 kronicdeth joined
22:34 <benwilson512> then I'd provide a module with a high level API that returns non ecto schema structs
22:34 <benwilson512> that people could simply use
22:35 <edmz> benwilson512: so changing from Task.async to Task.Supervisor.async should do the trick?
22:35 <edmz> or am I missing something?
22:35 <OliverMT> I would do it completely different in general
22:35 <benwilson512> edmz: well, making that change is an important step
22:35 <OliverMT> I would use a genserver and do a .call with a timeout
22:35 <benwilson512> do you understand what the issue is?
22:35 <OliverMT> and in the handle_call I would send noreply and do the reply later
22:36 <OliverMT> it encapsulates your logic in a way more streamlined way than cobbled together tasks imo
22:36 <cmk_zzz> benwilson512: I'm not to worried about it, just wondering if that was common practice in elixir. Especially with the way phoenix is moving with "boundaries" it seems ecto schemas are an implementation detail that should not go outside of the API because then you can never change your underlying storage implementation
22:36 <benwilson512> cmk_zzz: if you want to provide that kind of abstraction you want different applications
22:36 <benwilson512> not different contexts
22:36 <OliverMT> the call site deals with the timeout scenario, the genserver handles the rest
22:36 <edmz> the cowboy process gets linked to the async process?
22:37 <OliverMT> do you understand my description edmz ?
22:37 <benwilson512> edmz: yes, that's what Task.async does yea
22:37 <cmk_zzz> benwilson512: I see
22:37 <OliverMT> benwilson512: dont see why that gives him two identical request ids in that example though
22:37 <OliverMT> they are generated long before his async code kicks in
22:37 <benwilson512> OliverMT: because the same erlang process is handling both requests
22:37 <benwilson512> and if cowboy can't parse it
22:37 <benwilson512> plugs can't run
22:37 <benwilson512> and if plugs can't run, nothing will clobber the previous request id
22:38 <OliverMT> isnt it a process per request in cowboy?
22:38 robinsjdotcom joined
22:38 <OliverMT> TIL
22:38 <benwilson512> not always, it'll reuse them if it judges it worthwhile
22:38 <edmz> benwilson512 : I don't understand why cowboy is reusing the request, though
22:38 <edmz> ok
22:38 duane_ joined
22:38 <OliverMT> I still think this should be a simple genserver call
22:38 <OliverMT> with a timeout and a async reply
22:38 <benwilson512> depends on how much concurrency you want
22:39 <benwilson512> edmz: what is the nature of the work btw?
22:39 <OliverMT> async replies gives just as much concurrency :p
22:39 <OliverMT> its just encapsulated cleaner
22:39 <OliverMT> he could still do the work in an (unlinked) task
22:39 <benwilson512> never have unlinked tasks :p
22:40 <benwilson512> OliverMT: I guess what I'm saying is that the genserver still needs to spawn a task if it's gonna do anything async
22:40 <benwilson512> and so you still need the task supervisor
22:40 <benwilson512> and the genserver will likely crash if it tries to reply to a process that is no longer there
22:40 <OliverMT> I am generally agreeing with that mantra, but only because it makes it harder for newbs to shoot their own foot
22:40 <benwilson512> so now you gotta monitor every person who sends you a task
22:40 <benwilson512> so that you don't reply if they go down
22:40 <edmz> we sell digital goods (suscriptions is an example). Since we own the stack, we now that 99.99% of requests are succesful. So, if it is taking to long to respond to a request we return a successful response anyway. In the background the process will finish after those N seconds.
22:41 <OliverMT> a genserver crashes if you GenServer.reply to a non existing pid?
22:41 <benwilson512> OliverMT: actually that may be wrong, not sure ;)
22:41 <OliverMT> the docs say
22:41 <benwilson512> edmz: your solution seems like a good way to start
22:41 <OliverMT> This function always returns :ok.
22:41 <OliverMT> :p
22:41 <benwilson512> OliverMT: aight I'm wrong :D
22:41 <benwilson512> edmz: just start the process under a supervisor
22:42 <benwilson512> instead of under the request process
22:42 <benwilson512> the whole point is that they should have different lifetimes
22:42 <benwilson512> so you don't want them to be linked
22:42 <benwilson512> but you always want the task linked to SOMETHING
22:42 steffkes joined
22:42 steffkes joined
22:42 <benwilson512> ergo, supervisor
22:42 <OliverMT> unless you know the task cant deadlock
22:42 <OliverMT> :D
22:42 <edmz> benwilson512 : are you talking about OliverMT's suggestion or the Task.Supervisor one?
22:42 <benwilson512> Task.supervisor, I think doing a genserver is gonna be a bottleneck
22:42 <benwilson512> and I'm not sure it wins you much
22:43 <benwilson512> it's definitely more code
22:44 DeadTrickster joined
22:45 <OliverMT> what happens if your task crashes while running under task supervisor, does it bring down other tasks connected to same supervisor?
22:46 <edmz> benwilson512 : thank you. I understand the need to start the process linked to something else that cowboy/plug. But I get confused with "star the process under a supervisor". Isn't that what Task.Supervisor.async would do under the hood?
22:46 <edmz> I feel like I am still missing something
22:46 <benwilson512> you need to pass that function the name or pid of a supervisor
22:46 <benwilson512> so you need to add a supervisor under your top level supervision tree
22:46 <edmz> ahh, duh. I see
22:46 <OliverMT> I am a big fan of call genserver, do work in non linked task, use ref and from to send reply in task
22:46 <benwilson512> name it something, and then use that name as the first argument to Task.Supervisor.async_nolink
22:47 refriedchicken joined
22:47 <OliverMT> just requires call site to use timeouts, or your system deadlocks
22:48 bionj joined
22:50 maxbeizer joined
22:51 <benwilson512> timeouts ftw
22:51 refriedchicken joined
22:51 <OliverMT> good practice anyways imo
22:51 <OliverMT> since the default is :infinity
22:51 <OliverMT> :D
22:52 <benwilson512> for what, GenServer.call?
22:53 <OliverMT> yes
22:53 <benwilson512> nah it's 5 seconds https://hexdocs.pm/elixir/GenServer.html#call/3
22:53 hipertracker joined
22:53 <OliverMT> no wait yes it is
22:54 <OliverMT> wtf
22:54 <OliverMT> we were having loads of trouble before we set an explicit timeout
22:54 <benwilson512> weird. bare receive has no timeout but
22:54 <OliverMT> oh wait, multi_call has infinity
22:54 <benwilson512> GenServer.call definitely has always had a 5 second one
22:54 <benwilson512> ah hm
22:54 <benwilson512> that's interesting
22:54 <OliverMT> so if a node went awol
22:54 <OliverMT> we deadlocked
22:54 <benwilson512> wonder what the rational for that is
22:54 <OliverMT> we're doing distributed calls instead of managing merging state
22:55 <OliverMT> simply because I dont really understand mnesia and unsplit well enough
22:55 <OliverMT> and client had already sold what we were building :D
22:55 <OliverMT> you need to be a little bit over the top explicit and think carefully about what you're doing
22:55 <OliverMT> but distributed work using multi_call is suprisingly easy to do well
22:56 sfbw joined
22:56 <OliverMT> and you dont have to worry about split brain and merging or whatnot
22:56 <benwilson512> well
22:56 <benwilson512> what happens when a node goes awol an then comes back?
22:56 jkreeftmeijer joined
22:56 <OliverMT> we resolve at call site
22:57 <OliverMT> if you multi call and get more than one result we kill with hard prejudice
22:57 <OliverMT> hulk smash a random nodes data
22:57 <OliverMT> this is managing external listeners doing long polling with hackney async
22:57 <OliverMT> so worst case we have two listeners until the nodes sync back up
22:58 <OliverMT> (which we want, or the people on the orphan node would get no data from the listener)
22:58 <OliverMT> we use distribution to have less listeners globally
22:58 <edmz> so, since the supervisor doesn't supervise anything yet until async_nolink is called, how do I define it?
22:58 <edmz> https://gist.github.com/edmz/63a60b07f488aeb6e12eef7601c24a8e
23:00 <benwilson512> edmz: you don't need a custom supervisor
23:00 <benwilson512> just
23:01 <benwilson512> add like
23:01 <benwilson512> supervisor(Task.Supervisor, [[name: MyApp.Task.Supervisor, max_seconds: 1, max_restarts: 1000]]),
23:01 <benwilson512> to your top level supervision tree
23:01 <benwilson512> then in your controller do Task.Supervisor.async_nolink(MyApp.Task.Supervisor, fn -> stuff(foo) end)
23:01 <edmz> ah, I see, it registers it
23:01 <edmz> ok
23:11 smt joined
23:13 <edmz> benwilson512, OliverMT : sadly, same result. status code 400
23:13 griffinbyatt joined
23:17 sfbw joined
23:26 marcdel joined
23:29 strykerkkd joined
23:30 milad joined
23:37 bionj joined
23:41 bionj joined
23:43 duane joined
23:44 cschneid_ joined
23:57 <edmz> curious thing, it only happens in production
23:57 <edmz> in development it works fine
23:58 rodolfojcj joined