Giter Club home page Giter Club logo

Comments (8)

kaysond avatar kaysond commented on June 14, 2024 1

FYI I just pushed an update that you may want to look at. It increases the timeout, improves the error message of the first error you were seeing, and logs the last http request/response so you can debug easily.

from deluge-php.

mrqaidi avatar mrqaidi commented on June 14, 2024

makeRequest function need alot of improvement also i can not see curl_close called anywhere

from deluge-php.

kaysond avatar kaysond commented on June 14, 2024

When you send an API request to deluge, you have to send a request id. A number that increases with every request you send. See: https://dev.deluge-torrent.org/wiki/Development/DelugeRPC. The response from Deluge also contains the same id.

This API throws an error if the response from deluge does not contain the correct id. Thought to be honest I'm not sure exactly how this could happen since php runs synchronously.

Can you post the http request/responses?

And you're right about no closing function. I'll have to add a cleanup function or something.

from deluge-php.

mrqaidi avatar mrqaidi commented on June 14, 2024

aha i dont know whats wrong but something is not right sometimes there is no connection here is my error log
[14-Jun-2018 13:57:01 UTC] movie title : Cowboys & Aliens [14-Jun-2018 13:57:01 UTC] movie torrent url : https://yts.am/torrent/download/160C08A3F5CD5DDE2421A63EA315054CF378D23D [14-Jun-2018 13:57:03 UTC] success : movie created [14-Jun-2018 13:57:08 UTC] Request for method core.add_torrent_url failed due to curl error (no. 28): Operation timed out after 5001 milliseconds with 0 bytes received [14-Jun-2018 13:57:08 UTC] Request for method core.add_torrent_url returned unexpected http code: 0 (expected 200) [14-Jun-2018 13:57:08 UTC] Error : downloading torrent [14-Jun-2018 13:57:08 UTC] retry : download torrent [14-Jun-2018 13:57:13 UTC] Request for method core.add_torrent_url failed due to curl error (no. 28): Operation timed out after 5000 milliseconds with 0 bytes received [14-Jun-2018 13:57:13 UTC] Request for method core.add_torrent_url returned unexpected http code: 0 (expected 200) [14-Jun-2018 13:57:13 UTC] retry Error : downloading torrent

from deluge-php.

kaysond avatar kaysond commented on June 14, 2024

That seems like a problem with your deluge daemon, or possibly you're sending too many requests too quickly.

Are you re-sending the request immediately on failure? It looks like your first request times out, then you send a second one which returns http code 0 after 5 seconds (which means no response). Try increasing the curl timeout length. I set it to 5s arbitrarily.

CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 5,

from deluge-php.

mrqaidi avatar mrqaidi commented on June 14, 2024

thank you very much i will test this one and give you feedback

from deluge-php.

mrqaidi avatar mrqaidi commented on June 14, 2024

also if its possible make a debug mode in class if its enabled then do Exception otherwise just log it bocz right now in my script i dont want to be stopped

from deluge-php.

kaysond avatar kaysond commented on June 14, 2024

There's not really a need for that. You should be wrapping your calls in try/catch statements anyways:

try {
$deluge = new deluge("https://127.0.0.1:8112", "yourpassword");
$torrents = $deluge->getTorrents(null, null);
$status = $deluge->getTorrentStatus($torrents[0]->hash, array(), array());
$deluge->close(); //Closes the cURL handle
}
catch (Exception $e) {
if (debug)
log($e->getMessage());
else
throw $e;
}

from deluge-php.

Related Issues (3)

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.