Mnho229
Pretty new to Elixir and I’ve been going through Elixir in Action. I sense this issue could be solved if I drop down to a previous Elixir version but any advice to be able to do this on 1.11 would be very nice.
In 7.2.1 it talks about implementing a cache to manage multiple to-do lists.
Code from the book’s repo: https://github.com/sasa1977/elixir-in-action/tree/master/code_samples/ch07/todo_cache/lib/todo
The problem is, when I run these commands after iex -S mix
{:ok, cache} = Todo.Cache.start()
{:ok, #PID<0.154.0>}
Todo.Cache.server_process(cache, "Bob's List")
#PID<0.156.0>
Todo.Cache.server_process(cache, "Alice's Lists")
I receive the following error:
21:28:33.353 [error] GenServer #PID<0.154.0> terminating
** (MatchError) no match of right hand side value: {:error, {:already_started, #PID<0.156.0>}}
(todo_cache 0.1.0) lib/todo/cache.ex:29: Todo.Cache.handle_call/3
(stdlib 3.13.2) gen_server.erl:706: :gen_server.try_handle_call/4
(stdlib 3.13.2) gen_server.erl:735: :gen_server.handle_msg/6
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.152.0>): {:server_process, "Bob's Lists"}
State: %{"Bob's List" => #PID<0.156.0>}
Client #PID<0.152.0> is alive
(stdlib 3.13.2) gen.erl:208: :gen.do_call/4
(elixir 1.11.2) lib/gen_server.ex:1024: GenServer.call/3
(stdlib 3.13.2) erl_eval.erl:680: :erl_eval.do_apply/6
(elixir 1.11.2) src/elixir.erl:280: :elixir.recur_eval/3
(elixir 1.11.2) src/elixir.erl:265: :elixir.eval_forms/3
(iex 1.11.2) lib/iex/evaluator.ex:261: IEx.Evaluator.handle_eval/5
(iex 1.11.2) lib/iex/evaluator.ex:242: IEx.Evaluator.do_eval/3
(iex 1.11.2) lib/iex/evaluator.ex:220: IEx.Evaluator.eval/3
** (exit) exited in: GenServer.call(#PID<0.154.0>, {:server_process, "Bob's Lists"}, 5000)
** (EXIT) an exception was raised:
** (MatchError) no match of right hand side value: {:error, {:already_started, #PID<0.156.0>}}
(todo_cache 0.1.0) lib/todo/cache.ex:29: Todo.Cache.handle_call/3
(stdlib 3.13.2) gen_server.erl:706: :gen_server.try_handle_call/4
(stdlib 3.13.2) gen_server.erl:735: :gen_server.handle_msg/6
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
(elixir 1.11.2) lib/gen_server.ex:1027: GenServer.call/3
This seems to only happen when I change the string in the second parameter. Adding another clause for the case statement didn’t stop the error. How do I get past this?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #iex
- #elixirconf-us
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
APB9785
I just downloaded the files and compiled them with Elixir 1.11.3.
No errors. So there must be some differences, either between your code and the repo code, or in the commands you’re running. Glancing at the code, that string in the second parameter is only used as a map key. You should be able to pass any string as the name.
Ljzn
I cloned the code, and didn’t got any error. Maybe some code has changed?
my elixir version is 1.11.3, erlang 23
Mnho229
It did work when I cloned the code over. So I took another look, and then it turns out my server.ex had its name parameter filled in. And the files I was meticulously looking over might have been in a different folder.
This is embarrassing.
Thank you all for replying.