tourmaline v0.19.0 Release Notes

Release Date: 2020-06-05 // almost 4 years ago
  • ⚡️ This is a pretty massive update, and there's way too much to go into here. Basically though, if I were to break this update down into a couple achievements this is what we have:

    Connection Pooling

    I, and others, were having some issues earlier on using the client in a concurrent environment. This is because the client was using a single HTTP::Client which was being shared between threads/fibers. When one fiber would finish it would close the connection, causing a very confusing stack trace that said nothing about what the root of the problem was.

    🐎 After much testing and debugging I decided to add a connection pool, which is basically like a library of HTTP::Client instances. The pool has a finite number of instances it can spawn, and starts with a limited number. When a request is made the client checks out a client, uses it, and then checks it back in to the pool. It's thread safe and works perfectly, at a very small cost to performance.

    Proxies

    Another requested feature was proxy support. Unfortunately Crystal's HTTP::Client doesn't support proxies itself, but thanks to mamantoha/http_proxy I was able to implement proxy support pretty easily. The Client initializer now accepts several parameters for configuring the proxy as well.

    PagedInlineKeyboard

    👀 I added a convenience class for creating paginated inline keyboards called PagedInlineKeyboard. You can see it in action in the pagination bot example.

    Stage

    Last, but certainly not least, I have finally managed to implement some form of state management in the form of a Stage. It's not perfect, but you can now have "conversations" with your bot in which you collect information and do something with it.

    👀 You can see an example of a Stage in action in the stage bot example, which I've tried to document very well.