Giter VIP home page Giter VIP logo

Comments (3)

mtrudel avatar mtrudel commented on May 18, 2024 1

Noted and agreed! I'll get this updated just as soon as I can!

from thousand_island.

mtrudel avatar mtrudel commented on May 18, 2024 1

This is describing the fact that, if your Handler implementation happens to implement any other handle_* calls other than those that are part of the ThousandIsland.Handler behaviour, any read timeout is cancelled. For example, if you have a handler like this:

defmodule Echo do
  @moduledoc """
  A sample Handler implementation of the Echo protocol
  https://en.wikipedia.org/wiki/Echo_Protocol
  """

  use ThousandIsland.Handler

  @impl ThousandIsland.Handler
  def handle_data(data, socket, state) do
    ThousandIsland.Socket.send(socket, data)
    {:continue, state, 60_000}
  end

  def handle_info(msg, state), do:
    # Calling this will cancel the 60s timeout set above
    {:noreply, state}
  end
end

The reason for this is that Thousand Island itself is just a bit of sugar on top of GenServer, and read timeouts are set as part of this sugar. (This is the same reason that any such handle_info/2 calls will see state as {socket, state}). If you do implement callbacks as above, you can always pass any GenServer compliant result tuple back, including those that seem timeouts.

from thousand_island.

Dowwie avatar Dowwie commented on May 18, 2024

@mtrudel for my own understanding, any anyone who searches this in the future, and before official docs explain more clearly-- what is this about? :)

from thousand_island.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.