luizamboni

luizamboni

How to create module based Tasks

Im trying reproduce the example of module-based task like the example

in my try

https://github.com/luizamboni/elixir-study/blob/master/otp/5-task/module-task.exs

What is wrong ?
Thanks!

Marked As Solved

net

net

The docs are wrong.

number = 5
Supervisor.start_link([{TaskModule, number}], strategy: :one_for_one)

Since your module takes a number and adds 2 to it, we’re passing in a number (5) as the argument. You can pass in whatever you like.

See also: Supervisor — Elixir v1.20.2

Also Liked

NobbZ

NobbZ

As you can see, Task.__using__/1 does not exist in v1.4.2, so if you want to use it, you need to update.

https://github.com/elixir-lang/elixir/blob/v1.4.2/lib/elixir/lib/task.ex

Also you can take a look at the documentation of 1.4.2, the example there does not mention any use of use :wink:

luizamboni

luizamboni

thank you !
this forum is observed by core team ?
We can alert about this.
Is a trouble for newbies

Last Post!

OvermindDL1

OvermindDL1

It is (mostly) but it is still good to submit an issue ticket on github. :slight_smile:
Or better yet, a PR! ^.^

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44608 311
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement