Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:45
    mixflame edited #1265
  • 04:01
    mixflame synchronize #1265
  • Jun 16 21:00
    mixflame synchronize #1265
  • Jun 16 08:11
    mixflame edited #1265
  • Jun 16 08:10
    mixflame edited #1265
  • Jun 16 06:55
    mixflame synchronize #1265
  • Jun 16 06:47
    mixflame synchronize #1265
  • Jun 16 06:45
    mixflame synchronize #1265
  • Jun 16 02:01
    mixflame opened #1265
  • Jun 16 00:54
    mixflame synchronize #1262
  • Jun 16 00:54
    mixflame closed #1262
  • Jun 15 18:38

    elorest on stable

    (compare)

  • Jun 15 18:38

    elorest on stable

    (compare)

  • Jun 15 18:38

    elorest on v1.0.0rc2

    (compare)

  • Jun 15 18:38

    elorest on master

    Bumped version number to v1.0.0… (compare)

  • Jun 15 01:58
    renich commented #1251
  • Jun 15 01:57
    renich commented #1251
  • Jun 15 01:49
    renich commented #1251
  • Jun 13 07:20

    elorest on stable

    (compare)

  • Jun 13 07:20

    elorest on stable

    (compare)

Damian Hamill
@damianham
@mixflame you probably need to add this line to your config/application.cr as the default pubsub adapter is the memory adapter
Amber::Server.instance.pubsub_adapter = Amber::WebSockets::Adapters::RedisAdapter
backward crazy mage puppy 36
@backward-crazy-mage-puppy-36_gitlab
Hi, I want to implement parallelism like in ruby parallel gem (https://github.com/grosser/parallel)
Parallel.each(User.all, in_processes: 8) do |user|
user.update_attribute(:some_attribute, some_value)
end
In crystal. Any ideas how this can be done in crystal?
I have a database of 20 million dated records on which I need to perform several analysis (50+) and store the results for each analysis and each date back into the database. So executing in parallel processes will save me a lot of time. Thanks.
Jonathan Silverman
@mixflame
hey @damianham I was doing the equivalent of that by hacking the Amber code and I think the redis adapter is broken for me, it's only capable of subscribing to 1 topic. i'm using 4 sockets with 1 channel per each so it doesn't work
Jonathan Silverman
@mixflame
@damianham when I use that line I get this
Unhandled exception in spawn: Must call subscribe without a subscription block when already inside a subscription loop (Redis::Error)
  from lib/redis/src/redis/commands.cr:1661:22 in 'subscribe'
  from lib/amber/src/amber/websockets/adapters/redis.cr:25:9 in '->'
  from /home/jonathan/.asdf/installs/crystal/1.0.0/share/crystal/src/primitives.cr:255:3 in 'run'
  from /home/jonathan/.asdf/installs/crystal/1.0.0/share/crystal/src/fiber.cr:92:34 in '->'
  from ???
Damian Hamill
@damianham
@mixflame looking at subscribe() in redis/commands.cr:1655 it looks like you can only call this once with a block so you can only subscribe to a single topic because lib/amber/src/amber/websockets/channel.cr#setup_pubsub_adapter:75 sets up the adapter with a String and in your case what you want to do is setup the adapter with an array of String, one for each topic but it looks like you can't do that currently with Amber. A PR to rework the client_socket and channel stuff to handle your use case is called for. I think @drujensen suggested soem tiem ago that this needed some work and I think it was Nick Franken @fridgerator that did the initial implementation.
Jonathan Silverman
@mixflame
thanks for the info @damianham !!! I agree that we need the functionality to subscribe with an array of strings :)
Jonathan Silverman
@mixflame
Since I really need this, I will try my hand at modifying amber to allow this
Jonathan Silverman
@mixflame
i tried to make something but am not currently using it
you can see my process in the pull request
it seems to still drop every 1st message when it subscribes, i worked in the redisadapter code. can you see why my code drops messages? I think it's due to the begin...rescue... resubscribing after setup_pubsub has already been called once. Why is the pubsub setup being called twice?
canvas joined
{"event" => "join", "topic" => "canvas:"}
subscribing to ["canvas", "chat", "persistence", "session"]
chat joined
persistence joined
subscribing to ["canvas", "chat", "persistence", "session"]
Ivan
@VanyaNeytrino
Hello. Does FULL OUTER JOIN not work in amber?
Person.all ("FULL OUTER JOIN posts ON posts. person_id = people.id") this code generates a bunch of n+1 requests.
Screenshot 2021-06-05 at 17.20.20.png
NegativeSector
@dfghjkjhgr

Help. I tried installing Amber via homebrew and it kept on giving me this error.`Unable to satisfy the following requirements:

  • crystal (>= 0.35.0) required by amber_router 0.4.4
  • crystal (>= 0.34.0, < 2.0.0) required by json_mapping 0.1.1
  • crystal (>= 0.35.0) required by ameba 0.13.4
  • crystal (~> 0.30, >= 0.30.0) required by cli 0.9.3
    Failed to resolve dependencies, try updating incompatible shards or use --ignore-crystal-version as a workaround if no update is available.

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/amberframework/homebrew-amber/issues

Error: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force

If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Alternatively, manually download them from:
https://developer.apple.com/download/more/.
You should download the Command Line Tools for Xcode 12.5.`

Jonathan Silverman
@mixflame
@dfghjkjhgr install amber from source and use the --ignore-crystal-version flag when you are dealing with the shards command
Isaac Sloan
@elorest
So amber is upgraded to 1.0 on master. CI doesn't pass but specs seem to pass locally.
Isaac Sloan
@elorest
You shouldn't have to use --ignore-crystal-version anymore
Nightloewe
@Nightloewe
Can you also render templates at runtime which are in a separate directory, so not included in src directory?
Damian Hamill
@damianham
@Nightloewe no you can't render templates at run time - the templates are compiled like everything else at build time.
Damian Hamill
@damianham
@dfghjkjhgr I find the best way to develop an Amber app is to use Docker then there are no installation issues on your local workstation. See the Docker section in the online docs.
Maximilian
@alliedarmour
Hi, I'm quite new to amber (wanna try something else after 4 years of Rails) and I've got a question regarding the validation errors: If I validate for example the user's email and password, how do I rescue the validation errors and show it? user = User.new user_params.validate! I always get redirected to an Error 500 page
can't you do something like if user.valid? ... else ....
Maximilian
@alliedarmour
And user.errors seems to be empty
Jonathan Silverman
@mixflame
got it @elorest
I tried and failed to upgrade amber redis websocket adapter to support multiple channels and failed repeatedly. This is a major feature request tho <3
Isaac Sloan
@elorest
@mixflame When you said tried and failed you mean in terms of PR approval or fuctionality?
Jonathan Silverman
@mixflame
functionality... wasn't good enough... dropping 1st messages... i might try again because i need it so bad... @elorest
@elorest ^
check my PR, code should be in there i think... if you wanna try to fix it
none of my approaches resulted in reliable 5 channel subscription streaming
Jonathan Silverman
@mixflame
or maybe guide me through how websockets is set up and i can patch it myself @elorest
Isaac Sloan
@elorest
Sorry. I'm swamped for the time being. I can try to check it out in a couple weeks. See what you can do in the meantime.
Jonathan Silverman
@mixflame
ok! np. I'll give it my all soon here @elorest
Jonathan Silverman
@mixflame
mixflame's version of amber has been force updated to amberframework's version, same version now, i'll try again with my redis patch shortly.
Jonathan Silverman
@mixflame
w0000000000000000000000t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! i did it!!!!!!!!!!!!!!!!
i upgraded amber redis adapter to support multichannels
no config changes!
mixflame/amber has it
it's alive!!!!
Jonathan Silverman
@mixflame
so... it didn't work with multiple processes but i could use some insight about how this works... it's clearly the correct patch for the actual adapter. enjoy :)
Jonathan Silverman
@mixflame
well.. the patche seems to wear out for after a while but is a good starting point for multichannel redis adapter
Jonathan Silverman
@mixflame
disregard previous comments... i did it
redis adapter will subscribe once per application lifetime
to all channels
no config changes
just enable the redis adapter and get multichannel support
Jonathan Silverman
@mixflame
2 processes running 2 cores with custom redis seems to work... i couldn't use more cores than processes. definite speed increase
custom redis web socket adapter... gl and enjoy.. made with love for Amber from Jon
ok... looks like two processes will work with port_reuse disabled...
Jonathan Silverman
@mixflame
I noticed a Race condition in my design... the subscribe still doesn't happen early enough, websocket channels can be joined before the subscribe completes. Maybe Amber is faster than Redis? I simply disabled the patch in my code but the patch still stands. The subscribe simply needs to happen faster or wait until its completed.