GithubHelp home page GithubHelp logo

Comments (12)

visciang avatar visciang commented on July 30, 2024

Hi @lawik,

I've pushed branch ISSUE-137, it extend the example/example_bot.exs with a command to send you back a photo.
Just tested right now and "it works on my machine"!

Could you play there and check again?

Start the bot from that branch:

~/Code/telegram ISSUE-137
❯ BOT_TOKEN=___YOUR_BOT_TOKEN___ ./example/example_bot.exs

then from a telegram client send to your bot the command /send_photo.
You should get back the telegram logo without notification sound.

If you can pin the variables that give you the issue will be easier to backtrack the root cause.

from telegram.

visciang avatar visciang commented on July 30, 2024

Some constraints on photos are described here (max 10 MB, ...) https://core.telegram.org/bots/api#sendphoto
Anyway, a HTTP request (multipart or not) should end soon or later, even more considering:

    @gun_config Application.compile_env(:telegram, :gun_config,
                  timeout: 60_000,
                  connect_timeout: 5_000,
                  certificates_verification: true)

from telegram.

lawik avatar lawik commented on July 30, 2024

Did some fun debugging. My images were slightly bigger, 211Kb and up. Not big by any means but bigger than 6.3Kb that you have for testing. So yours is just under 64Kb :)

I tried padding your image with 1Kb of nulls until a send failed.

I was okay sending 64745 bytes.
I failed sending 65769 bytes.

from telegram.

lawik avatar lawik commented on July 30, 2024

So yes, your example works. No other image I have will :D

from telegram.

lawik avatar lawik commented on July 30, 2024

Oh, and it never returns. It idles for 30 seconds and then times out and retries.

from telegram.

visciang avatar visciang commented on July 30, 2024

Ahh!
I would like to play with the tesla Telegram.Client adapter.
Currently it uses gun and the Retry middleware (with default opts)

from telegram.

lawik avatar lawik commented on July 30, 2024

It also happens with both {:file_content, binary, name} and {:file, path} variants which was surprising.

I just tried switching the entire client to Hackney. Went through, no issue. So this is probably an issue with Gun then.

Seems similar to this: elixir-tesla/tesla#230

from telegram.

visciang avatar visciang commented on July 30, 2024

Exactly what I expected!
Maybe more close elixir-tesla/tesla#394.

Honestly, the HTTP side of things is really horrible Erlang/Elixir side.
(even more now, when 99% of the beam app find application in the web and the 5G inter-NF is HTTP based).

from telegram.

lawik avatar lawik commented on July 30, 2024

Well found! That is the exact issue but not the same HTTP client.
I haven't had many problems with the HTTP-clients but I'll take your word for it :)

from telegram.

lawik avatar lawik commented on July 30, 2024

Is there a particular reason this library configures Gun and not another HTTP library? Can it be overridden with config?

I don't have time to figure out the Tesla problem but switching to Hackney seems to work fine.

from telegram.

visciang avatar visciang commented on July 30, 2024

No particular reason.

The tesa client adapter and its config could be made configurable, ie the library user can choose what to use or just leave the default (hackney).

And, by the way, the need to have an HTTP client stays in the pooler, that should be used in dev mode or if serving small amount of traffic. Another way to say it doesn't matter that much what client you use unless you have strong dependency requirements.

from telegram.

visciang avatar visciang commented on July 30, 2024

@lawik could you give a quick review to #138 ?

from telegram.

Related Issues (14)

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.