Skip to content

Conversation

@Billy2011
Copy link
Contributor

@Billy2011 Billy2011 commented Jul 12, 2018

Global http session obj should not be used because there may be problems
with other server/proxy applications.

@codecov
Copy link

codecov bot commented Jul 12, 2018

Codecov Report

Merging #1925 into master will decrease coverage by 0.3%.
The diff coverage is 14.07%.

@@            Coverage Diff             @@
##           master    #1925      +/-   ##
==========================================
- Coverage   51.57%   51.27%   -0.31%     
==========================================
  Files         242      242              
  Lines       14246    14155      -91     
==========================================
- Hits         7348     7258      -90     
+ Misses       6898     6897       -1

@beardypig
Copy link
Member

I like it. But, why is this commit 32e2458 included? Shouldn't you rebase on the upstream master to get this included.

@Billy2011 Billy2011 force-pushed the api-http-fix branch 2 times, most recently from c1caaea to 7722e67 Compare July 12, 2018 12:05
@back-to
Copy link
Collaborator

back-to commented Jul 12, 2018

you are still behind

https://github.com/Billy2011/streamlink/tree/api-http-fix


if you don't want to handle conflicts,
remove the changes in TV4Play before you start

this will REMOVE your last commit, but the files won't change

git reset --soft HEAD~1
git reset HEAD src/streamlink/plugins/tv4play.py
git checkout src/streamlink/plugins/tv4play.py
git commit -m "part 2 of 2; replace global http session by self.session.http"

small rebase guide

update your master branch

git checkout master
git pull upstream master

check the commit it should be 6bf654a291e2a792088384c7ba7c9dc9b2a14b1d

git show --name-status

change back to api-http-fix

git checkout api-http-fix
git rebase master

you will have to handle conflicts there
or update tv4play after if you removed it

@Billy2011 Billy2011 force-pushed the api-http-fix branch 3 times, most recently from a77f302 to 7722e67 Compare July 12, 2018 12:32
@Billy2011 Billy2011 closed this Jul 12, 2018
Global http session obj should not be used because there may be problems
with other applications.
@Billy2011
Copy link
Contributor Author

All PR's end up with me - it is no longer possible to create a PR for streamlink???

@back-to back-to reopened this Jul 12, 2018
@back-to
Copy link
Collaborator

back-to commented Jul 12, 2018

I think it should work now, if you push something to Billy2011:api-http-fix

@Billy2011 Billy2011 closed this Jul 12, 2018
@Billy2011 Billy2011 deleted the api-http-fix branch July 12, 2018 14:35
@Billy2011 Billy2011 restored the api-http-fix branch July 12, 2018 14:51
@Billy2011 Billy2011 reopened this Jul 12, 2018
@Billy2011 Billy2011 changed the title streamlink.plugins: part 1; replace global http session by self.session.http streamlink.plugins: replace global http session by self.session.http Jul 12, 2018
@beardypig
Copy link
Member

What's happening here? :D

@Billy2011
Copy link
Contributor Author

I've been wondering the same thing all day (•ิ_•ิ)?

@Billy2011
Copy link
Contributor Author

How can I fix the test plugins garena + tvplayer?
That, for example, no longer exists: streamlink.plugins.garena.http

@beardypig
Copy link
Member

@Billy2011 Billy2011#10 :)

tests: fix tests to use session.http
@Billy2011
Copy link
Contributor Author

Billy2011 commented Jul 13, 2018

Must the global var. api.http and all remaining references to it be preserved?
Why is there a streamlink session reference in the Plugin class if it is not explicitly used?
Unfortunately, requests is not completely thread safe and a global api.http will not improve that.

Copy link
Collaborator

@back-to back-to left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because this PR basically blocks all other Plugin PR

the decision if a DeprecationWarning of from streamlink.plugin.api import http should be added or not could be done in a different PR,

which would also be better viewable in the commit history.

@beardypig
Copy link
Member

Anything that referrers to the global should be removed. While it won’t help with the thread safety, we will have more control - for example, we could create one session per thread ID (not sure if that’s actually a workable idea).

@Billy2011
Copy link
Contributor Author

I think the last reference to api.http is in streamlink.session, should I remove that?

@beardypig
Copy link
Member

I think the last reference to api.http is in streamlink.session, should I remove that?

@Billy2011 Can you post a line reference? Maybe that one will have to be done separately :)

@Billy2011
Copy link
Contributor Author

Billy2011 commented Jul 17, 2018

@beardypig, in line 469 api.http = self.http

@beardypig
Copy link
Member

beardypig commented Jul 17, 2018

@Billy2011 I believe that would make it a breaking change. We should open a separate PR for that, and probably keep it open until we are ready for 1.0.0 :)

With this PR, there should be nothing using it - but custom plugins might use it, as we provide an API that other people can use this should be considered a break change and will require a major version bump. If there are more breaking changes we want to make we should do those for 1.0.0 as well.

@Billy2011
Copy link
Contributor Author

OK, then I hope that this PR is ready to merge and no other member raises an objection :)

Copy link
Member

@beardypig beardypig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks OK.

@gravyboat
Copy link
Member

Alright let's get this in then, thanks for the hard work @Billy2011, and for the feedback everyone!

@gravyboat gravyboat merged commit fb6a00c into streamlink:master Jul 17, 2018
@Billy2011 Billy2011 deleted the api-http-fix branch July 18, 2018 10:40
jackyzy823 pushed a commit to jackyzy823/streamlink that referenced this pull request Jul 22, 2018
…treamlink#1925)

* streamlink.plugins: replace global http session by self.session.http
beardypig pushed a commit to beardypig/streamlink that referenced this pull request Jul 25, 2018
…treamlink#1925)

* streamlink.plugins: replace global http session by self.session.http
@bastimeyer bastimeyer mentioned this pull request Feb 21, 2020
mkbloke pushed a commit to mkbloke/streamlink that referenced this pull request Aug 18, 2020
…treamlink#1925)

* streamlink.plugins: replace global http session by self.session.http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants