ruby - Overriding/Modifying Rails Class (ActiveResource) -
I am now struggling with a problem with ActiveResource for a while: when a hostname for an ActiveResource request Fixes, but there is no server at the other end to return information, the timeout value of ActiveResource does not work. The request is only hanging.
After reviewing the ActiveResource code, I have realized that this is the built-in Net: Only a timeout value is set in the HTTP object: read_timeout nets: the HTT library calls it a volume (a read (2) call ) Defines as "seconds" to wait until reading. Net: HTTP also defines OpenTimeout, another timeout value, which is defined as "seconds to wait until the connection is opened".
I'm unsure why open_timeout is not set with the timeout value set by an ActiveResource class by default, but after adding ActiveSourceource :: Connection class to open_timeout on http object, my problem was solution!
I am new to the railways, so I am really unsure about the best way to make this amendment in my project; I just do not want to change the code in my gem directory, is there a proper way to make these modifications in railway projects? I have seen that it is possible to load rail classes from the / vendor folder, but do all have to work for it? I have started creating subset of ActiveResource :: Base and ActiveResource :: connection classes, but it seemed like there was an easy way to do this, as the function that creates the net: The HTTP example is private ... Any ideas?
First of all, this is an issue that you should report to rail 'bugtracker:
When I have to do a lot of hotfix of such things, then I usually make the analytics file in the RRR_RO / config / analyzer and should re-open the square to fix it.
Class ActiveResource :: Base # Your Fixes End Here
This is called Monkey Patching and there is something controversial but I personally believe it It is very cruel to present a new level in Virat Jugrama which has no meaningful meaning for my code.
Comments
Post a Comment