java - How to identify which endpoint a Twitter4j RateLimitStatusEvent contains the limit for -


i building application in java 8 using twitter4j (twitter4j-core:4.0.6) crawl friendships , followers. going populate graph structure data, , expecting hit rate limits pretty fast, trying build application in such way exhausted endpoints go sleep.

to sure have correct number of remaining calls, other apps, threads or instances exhaust same pool of requests, trying use ratelimitstatuslistener interface have onratelimitstatus(ratelimitstatusevent event) , onratelimitreached(ratelimitstatusevent event) control sleep flags loops.

the problem however, can't seem find anywhere access endpoint, i.e. "/friends/ids", "/followers/ids" or "/users/lookup", ratelimitstatusevent corresponds to.

i have considered looking rate limit , keep local count, if there multiple instances, other apps etc. accesses info @ same time, rate limits reached before local count aware of. might publish application when finished, , might have more 1 simultaneous user.

does know of way twitter4j, or have roll own?

another possibility, not mentioned in comment @kadir yet, using map<string, ratelimitstatus> getratelimitstatus(string... resources) throws twitterexception on twitter instance.

this method perform rest call application/rate_limit_status endpoint , return current rate limit status given resource familiy. documentation of endpoint can found here.

in case, use endpoint ask resource-families friends, users, followers , can obtain rate-limit status of endpoints related families.

however, calling endpoint may result in rate-limit.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -