Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 10:19
    straight-shoota ready_for_review #12802
  • 10:19
    straight-shoota edited #12802
  • 10:18
    straight-shoota synchronize #12802
  • 10:17
    straight-shoota closed #12806
  • 10:17
    straight-shoota closed #12810
  • 10:08
    straight-shoota labeled #6657
  • 10:08
    straight-shoota unlabeled #6657
  • 10:08
    straight-shoota unlabeled #6657
  • 10:08
    straight-shoota closed #6657
  • 10:07
    straight-shoota labeled #12816
  • 10:05
    straight-shoota synchronize #12816
  • Dec 01 23:53
    straight-shoota opened #12816
  • Dec 01 23:07
    straight-shoota edited #12814
  • Dec 01 23:01
    straight-shoota synchronize #12814
  • Dec 01 22:59
    straight-shoota edited #12814
  • Dec 01 22:58
    straight-shoota edited #12814
  • Dec 01 22:58
    straight-shoota edited #12814
  • Dec 01 22:55
    homonoidian opened #12815
  • Dec 01 22:55
    homonoidian labeled #12815
  • Dec 01 22:53
    straight-shoota edited #12814
George Dietrich
@Blacksmoke16
could still do that by just having two separate entrypoints that require common code and only the routes each server should have
do you know about {{debug}}?
moe
@moe:busyloop.net
[m]
ha, yea, it's fun to get these comments from other framework devs. :D of course you'd spot that right away and yea that's exactly my thinking. i can have multiple listeners already, will prob add optional scoping of endpoints to listeners sometime. so then multiple "instances" will be possible, just without it being an actual class instance.
yea {{debug}} is mighty helpful, although i've needed it surprisingly rarely. the compiler errors have gotten really good, most of the time it dumps the relevant part by itself
George Dietrich
@Blacksmoke16
exactly yea. Its mostly under the "worry about it when there's an actual use case for it" bucket
j8r
@jrei:matrix.org
[m]
moe: multiple servers should be possible in a same app, otherwise it not a good sign of how the code is designed
There are cases like serving the swager docs in one interface + port, like localhost:8000, and the app to 0.0.0.0:8888
If @Blacksmoke16 and me did it, you can too
moe
@moe:busyloop.net
[m]

yup, i tend to agree. will be added at some point, it's totally doable. just not a high prio atm because... when was the last time you actually needed it? ;)

for me swagger is served on / by default. if it's a private api then there's auth on it (as per zero trust model). i don't remember ever encountering a case where multiple isolated appservers in one process was really needed. when it happens it's more often an artefact of e.g. wanting to serve prometheus metrics with an external lib. however, in that case that lib does its own HTTP::Server stuff anyway.

but yea, even if only for aesthetics, being a singleton doesn't feel right long-term ;)
George Dietrich
@Blacksmoke16
fwiw in athena the only way to have two servers is with two binaries
j8r
@jrei:matrix.org
[m]
I meant a bad sign because usually when we can do 2 servers, it means there are global vars around
The way I did it is to re-implement partially HTTP::Server, which is like 20 lines of code so that's ok
moe
@moe:busyloop.net
[m]
yea, it's not really global vars here, just all those generated classes, but should be straightforward to namespace them
j8r
@jrei:matrix.org
[m]
What about in specs?
It is not possible to run multiple servers, or instantiate multiple ones?
moe
@moe:busyloop.net
[m]
in spec the server doesn't even run 🤷 i pasted my helper somewhere above, it just instantiates requests and feeds them to the framework in the same way that HTTP::Server would
George Dietrich
@Blacksmoke16
same ^, athena is also technically decoupled from HTTP::Server as well. You could manually pass it an HTTP::Request and get back the ATH::Response then manually apply it to whatever. Main use case for this would be like serverless contexts. E.g https://github.com/awcrotwell/serverless.cr/blob/master/src/serverless/ext/athena.cr
j8r
@jrei:matrix.org
[m]
I mainly meant 2 instances of your framework object
If I understood correctly the limitation is when we to actually run the server, not when calling the framework directly in specs
George Dietrich
@Blacksmoke16
you could create two instances, but the catch is there technically is global vars involved given i didnt implement a way to filter which controllers are handled by a specific instance. Hence just using two binaries that only require the ones they want is wayy easier
moe
@moe:busyloop.net
[m]
hum, any way to create a PathLiteral from a StringLiteral? (to resolve it) 🤔
George Dietrich
@Blacksmoke16
ho oh boy, do i have something for you :)
moe
@moe:busyloop.net
[m]
w000t!
ha, i was so close on giving up on this one
muchos gracias 🙇
George Dietrich
@Blacksmoke16
(it's new in 1.4)
moe
@moe:busyloop.net
[m]
just in time! 💪
From IRC (bridge bot)
@FromIRC
<riza> doing dev on a shard and i want to specify a local target as the source for a dependency...i've done this a hundred times by just adding path: ../other_shard and commenting out the version/github bits.
<riza> today it's failing with a "unable to satisfy the following requirements" message
<riza> other_shard (*) required by shard.yml and other_shard (1.0 at ../other_shard) required by shard.lock
<riza> am I missing something obvious here or did the strategy for doing this change
From IRC (bridge bot)
@FromIRC
<riza> oh, adding the version specifier back but leaving the repo path seemed to work...
<riza> that feels a bit dirty, but I guess I undertsatd
From IRC (bridge bot)
@FromIRC
<riza> is there an easy way to get the compiler to tell me where the method I'm calling is defined?
<riza> I'm writing a test against a stdlib modification I've made -- the spec is running fine but I can't get the change I've made to do anything. Even dropping a 'raise' at the top of the method yields no change
George Dietrich
@Blacksmoke16
calling a diff overload?
From IRC (bridge bot)
@FromIRC
<riza> Oh I see. The stdlib specs don't run against the source like they do in a typical project, they run against the current compiler. So it's a 2 step process, make crystal and then bin/crystal spec ...?
George Dietrich
@Blacksmoke16
prob could do something with CRYSTAL_PATH
and point that at your local compiler stdlib versus the one included with the installed package
From IRC (bridge bot)
@FromIRC
<riza> I have no problem using bin/crystal to make that work. I just didn't realize that it required doing that.
George Dietrich
@Blacksmoke16
https://github.com/crystal-lang/crystal/blob/master/bin/crystal#L141 wrapper script is setting it to the local compiler for you
yea, stdlib dev is separate from compiler
From IRC (bridge bot)
@FromIRC
<riza> yeah for sure, when I run bin/crystal I get the warning message about the local compiler
emanzx
@emanzx
hi guys.. :-)
can I use this query
SELECT
  time_bucket('86400.0s',"time") AS "time",
  qname AS "domain",
  client_ip AS "IP",
  sum(count) AS "count"
FROM bind_rpz_log
WHERE
  "time" BETWEEN '2022-04-15T06:07:27.34Z' AND '2022-04-15T07:07:27.34Z' AND
  rpz_zone ~* 'feeder.csm.rpzdb.com'
GROUP BY 1, qname, client_ip
ORDER BY 1, qname
in granite?
George Dietrich
@Blacksmoke16
prob could do it as a one off query versus something you could make via the query builder or something
one off query meaning a raw query off the underlying DB::Database instance