Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ben Spencer
    @dangerousben
    is there a reason loggers in StateMachine and elsewhere aren't namespaced?
    eg you get log entries like:
    DEBUG state machine-0 - Transitioning to state 
    com.twitter.finagle.postgres.connection.AuthenticationRequired$ and emiting result
    which are a hassle to filter out in logback
    (also arguably they're noisy enough that they should be at trace level)
    jeremyrsmith
    @jeremyrsmith
    @dangerousben I don’t think there’s a reason. Feel free to change it.
    Ben Spencer
    @dangerousben
    Ben Spencer
    @dangerousben
    I have an issue with exceptions being thrown by SslHandler not being logged
    this is all I see:
    DEBUG c.t.f.p.c.PgClientChannelHandler - Detected channel disconnected!
    DEBUG c.t.f.n.c.ChannelStatsHandler - ChannelStatsHandler caught an exception
    INFO  c.t.finagle - FailureAccrualFactory marking connection to "postgres:master" as dead.
    if I add an exceptionCaught method to PgClientChannelHandler I can log it (it's a cert validation error), but I'm not sure whether that should be the responsibility of something else in the pipeline?
    Stefan Dietiker
    @d-s-d

    If I do something as simple as

    scala> val result = Await.result {c.select("select 1") { r => r.get[Int](0) } }

    in the console, it just hangs (the same is true for some actual queries). What am I doing wrong?

    Vladimir Kostyukov
    @vkostyukov
    @d-s-d This doesn’t look right. How you construct your client?
    Stefan Dietiker
    @d-s-d
    @vkostyukov val c = Postgres.Client().withCredentials("username", Some("password")).database("database").withSessionPool.maxSize(1).withBinaryResults(true).withBinaryParams(true).newRichClient("localhost:5432")
    What's interesting is that if I provoke an error by querying something like select nonexistentfunction(1), I get an exception back. The aforementioned select 1 however (or any other valid statement) hangs.
    Leon Maia
    @leonmaia
    @d-s-d I got to reproduce the same issue as you're having. The insteresting part is that it seems to hang only when using sbt console, since when I created a Main.scala and pasted the same code it worked as supposed.
    Leon Maia
    @leonmaia
    Maybe that's the reason? scala/bug#9076
    Stefan Dietiker
    @d-s-d
    I have a REST-API based on finagle/finch and I use finagle-postgres. So far so good. Now, I need to perform some tasks on a regular base. What I'm currently aiming for is scheduling a task with Java's Timer), and use the postgres-client with Await.result() in a synchronized fashion. The task itself is potentially long-running. Are there any caveats with this approach?
    jeremyrsmith
    @jeremyrsmith
    Finagle really doesn’t want you to block futures. Any particular reason you want to block it?
    Stefan Dietiker
    @d-s-d
    @jeremyrsmith I don't quite understand. What I'm doing is starting a separate Timer-thread that schedules a task on a regular basis. The task is inherently synchronous, so I use Await.result() to wait for the result. It should only block the thread of the Timer, no?
    Leon Maia
    @leonmaia
    @d-s-d I would suggest you to take a look into using a future pool instead, have a look into: https://twitter.github.io/finagle/guide/Futures.html#blocking-or-synchronous-work you can combine it with fx an Executor service, either that or take a quick look on the Akka scheduler it's also pretty easy to create what you're trying to achieve.
    Leon Maia
    @leonmaia
    Hi folks, I finished releasing the version 0.8.0. 🎉
    Ben Spencer
    @dangerousben
    :thumbsup:
    Ben Spencer
    @dangerousben
    @leonmaia did finagle-postgres-shapeless get released?
    Leon Maia
    @leonmaia
    no, I forgot about it. I can do in an hour or so.
    I'm also planning to create a document with the steps to do the release. I found myself googling and looking into DMs today to remember what I should do, since I'm not using the same macbook as the first time that I did the release :D
    Ben Spencer
    @dangerousben
    thanks
    Leon Maia
    @leonmaia
    @dangerousben finagle-postgres-shapeless 0.8.0 is published.
    Ben Spencer
    @dangerousben
    cheers :)
    Ben Spencer
    @dangerousben
    although it hasn't appeared on maven central yet, maybe there's a lag...
    Leon Maia
    @leonmaia
    yeah, should be there soon.
    Ben Spencer
    @dangerousben
    I'm thinking maybe we don't need a 1:1 mapping between CommandCompleteStatuss and actual postgres responses
    btw, I started the release of 0.8.2
    I tried to update the finagle version but it breakes with the latest version.
    Leon Maia
    @leonmaia
    I'll try to work on this as soon as I can, I changed jobs recently and free time is not something that you actually have during the first 100 days :D
    Leon Maia
    @leonmaia
    Release 0.8.2 out, with both the SSL session fix and the name resolution fix.
    Ben Spencer
    @dangerousben
    is RowDecoder ever intended to be implemented manually or should you just not use queryAs if you want custom decoding?
    re: case classes per tag, is that actually a benefit though? I suppose I can envision some future use for metrics purposes or something but for now it just seems to be boilerplate
    Leon Maia
    @leonmaia
    In my understanding now it just seems "boilerplate", I guess it adds a little bit of more clarity 🙂, but probably removing it makes the code more simple to read though.
    Ben Spencer
    @dangerousben
    wrt RowDecoder, the fact that queryAs is declared as queryAs[T <: Product] leads me to suspect that it was only ever intended to be used with auto derivation from case classes
    we were going to write a custom RowDecoder for a trait that picked the correct subclass based on the data, but it's not really any different to writing a reusable Row => T function to pass to prepareAndQuery
    @leonmaia I was more concerned with ease of adding support for new tags than readability
    currently you have to touch three places in the code like this: finagle/finagle-postgres@dbdb5fa
    jeremyrsmith
    @jeremyrsmith
    @dangerousben IIRC I think RowDecoder was intended to support auto-derivation… but it’s possible there could be APIs for manually constructing it that are easier than dealing with Row directly
    i.e. with lens-ish things and scodec-type combinators
    Ben Spencer
    @dangerousben
    what's supposed to happen if a ValueDecoder throws an exception?
    from the code it looks rather like it will silently return null :|
    jeremyrsmith
    @jeremyrsmith
    ValueDecoder returns a Try… IIRC there are places where the error is silently discarded (and you get null or 0) but there should be parallel APIs that give you the Try. My fault, sorry – maybe it should throw there, but it would have been a pretty big behavior change I think