Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 15 12:34
  • Jan 01 00:15
    Blacksmoke16 commented #436
  • Dec 31 2020 03:24
    Blacksmoke16 labeled #436
  • Dec 31 2020 03:24
    Blacksmoke16 labeled #436
  • Dec 31 2020 02:57
    caspiano opened #436
  • Dec 21 2020 02:36
    Blacksmoke16 commented #698
  • Dec 20 2020 09:46
  • Dec 18 2020 05:07

    drujensen on master

    Avoid using deprecated HTTP::Re… (compare)

  • Dec 18 2020 05:07
    drujensen closed #1242
  • Dec 17 2020 20:14
    bcardiff commented #1242
  • Dec 17 2020 20:13
    bcardiff opened #1242
  • Dec 15 2020 23:15

    drujensen on master

    Change documentation to prefer … (compare)

  • Dec 15 2020 23:15
    drujensen closed #433
  • Dec 15 2020 23:15

    drujensen on master

    Migrator: create columns with N… (compare)

  • Dec 15 2020 23:15
    drujensen closed #429
  • Dec 15 2020 21:49
    robacarp synchronize #433
  • Dec 15 2020 21:49

    robacarp on master

    Drop argument type restrictions… (compare)

  • Dec 15 2020 21:49
    robacarp closed #434
  • Dec 15 2020 21:48
    robacarp synchronize #433
  • Dec 15 2020 18:35
George Dietrich
@Blacksmoke16
wonder if the cache dir isnt in the container or something so its always cold
time crystal eval --release --stats --progress 'gets.not_nil!.to_i64'
first run is like 24s, then future ones are like 2
nvm, thats if you dont change anything
rukkiddo
@rukkiddo
I run that but it is stuck at:
Codegen (bc+obj):
  • no previous .o files were reused
Unhandled exception: Invalid Int64: (ArgumentError)
real 2m29.376s
user 0m16.610s
sys 0m0.290s
It continued when I pressed enter or maybe coincidence
I run again, same error but:
real 0m2.538s
user 0m1.081s
sys 0m0.196s
From IRC (bridge bot)
@FromIRC
<Dango9531> hola
<Dango9531> de<
rukkiddo
@rukkiddo
since my amber project compiles in 25 seconds, I thought I could do much faster than you guys, spent a week, migrated project to raw crystal server no it compiles in 5-8 seconds
but when I open a page it is like 15x slower lol
George Dietrich
@Blacksmoke16
how you handle routing?
rukkiddo
@rukkiddo
I created a class called Req
I have my methods like
Req.get "/" do
George Dietrich
@Blacksmoke16
i mean when a request comes in, how does it know what action to call
rukkiddo
@rukkiddo
class Req
    @@routes = {} of String => ( -> Html.class | View.class)
    @@session = {} of String => String
    @@redis = Redis.new


    def self.set_ctx(context : HTTP::Server::Context)
        @@ctx = context
    end

    def self.ctx
        @@ctx
    end

    def self.routes
        @@routes
    end

    def self.get(route, &block : ( -> Html.class | View.class))
        @@routes[route.to_s] = block
    end
end
oh it didnt look good here
now it looks better
anyways I was using same folder structure of amber
George Dietrich
@Blacksmoke16
so i guess it does something like Req.routes[request.path]?
rukkiddo
@rukkiddo
yeah
server = HTTP::Server.new do |context|
    Req.set_ctx(context)
    request = context.request
    response = context.response
    if ! request.cookies["id"]?
        session_id = Req.create_session()
    else
        session_id = request.cookies["id"].value
    end
    Req.fetch_session(session_id)
    if Req.routes[request.path]?
        res = Req.routes[request.path].call
        body = res.body
        type = res.type
    else
        body = "404 buddy"
        type = "text/html"
    end
    # request.cookies.add_response_headers()
    response.cookies["id"] = session_id
    response.content_type = type
    response.print body
end
what kind of magic amber is using
why it is so much faster
George Dietrich
@Blacksmoke16
i guess none of your routes have params
rukkiddo
@rukkiddo
they have from Req.ctx
George Dietrich
@Blacksmoke16
prob is making use of all your cpu cores
rukkiddo
@rukkiddo
but why it is using all cpu cores
I thought I wrote something so much smaller than amber
George Dietrich
@Blacksmoke16
no, im thinking thats why amber is faster
rukkiddo
@rukkiddo
hmm
if only there was a tool to convert between ruby and crystal. I could develop in ruby with a faster workflow, then I could compile in crystal to have better performance
I am almost sure it was't this slow when I first start with it
I mean by time either crystal or amber got slower for compiling
George Dietrich
@Blacksmoke16
crystal did
llvm to be specific
rukkiddo
@rukkiddo
and what we gained for sacrificing compilation speed
for instance is it now faster when you run etc.
George Dietrich
@Blacksmoke16
:shrug: not super familiar with that
George Dietrich
@Blacksmoke16
i dont think rolling your own framework is the best idea tho
rukkiddo
@rukkiddo
it definetly isn't the best idea, i am happy with the experience though
George Dietrich
@Blacksmoke16
fair enough
George Dietrich
@Blacksmoke16
amberframework/amber-router#28 @drujensen @eliasjpr
Damian Hamill
@damianham
I keep getting (DB::PoolRetryAttemptsExceeded) errors. I restart my production server at 4am every day but as the number of users is increasing this problem is still happening in the early evening when there is peak usage. I also got this problem on my local development instance which has very few requests but runs for a long time. I have just increased the max number of connections in postgres to 300. Is there anything else I can do to avoid getting this error.
George Dietrich
@Blacksmoke16
iirc something like this was reported in crystal gitter
prob worth reporting somewhere
Damian Hamill
@damianham
@drujensen @elorest I think the issue might be in granite/src/adapter/base.cr. A database connection is opened and stored in an instance variable rather than yielding the connection to a block and as far as I can see is never closed. The online docs for crystal DB state that you can use a non yielding DB.open method as long as Database#close is called at the end. Since DB:Pool takes care of connection pools is there a need to store the connection in an instance variable?