troydavisson / PHRETS

PHP client library for interacting with a RETS server to pull real estate listings, photos and other data made available from an MLS system
http://troda.com
MIT License
451 stars 235 forks source link

Connecting to multiple servers in one process encounters authentication issues #146

Open troydavisson opened 7 years ago

troydavisson commented 7 years ago

When looping through a number of RETS servers, you could run into cases where connection attempts fail.

Until a broader change is made, adding the following code before you make a new PHRETS Session object should get around the problem:

\PHRETS\Http\Client::set(new \GuzzleHttp\Client);
asanikovich commented 7 years ago

You can also be "401 Unauthorized" because of timeout.

ericlucit commented 3 years ago

Note that I ran into what is probably a similar issue

I have a Laravel Job Queue to which I dispatch jobs to process RETS data retrievals - Each of these jobs usually has a different set of login credentials.

The Job Queue runs as a background process using supervisord

This normally worked great until one time where Job B retrieved data from what appeared to be the credentials assigned to Job A - These jobs ran very close to each other (time-wise)

I don't know for sure, but I suspect this is session related - Because Job A and Job B had different queries and I could tell that JobB executed the correct query but executed it using Job A credentials -

The net effect was Job B retrieved properties for the wrong brokerage

I updated my code to do 2 things now and hopefully this clears up the issue