优化
This commit is contained in:
@@ -320,11 +320,16 @@ class AnalyzeUrl(
|
|||||||
val rateIndex = concurrentRate.indexOf("/")
|
val rateIndex = concurrentRate.indexOf("/")
|
||||||
var fetchRecord = concurrentRecordMap[source.getKey()]
|
var fetchRecord = concurrentRecordMap[source.getKey()]
|
||||||
if (fetchRecord == null) {
|
if (fetchRecord == null) {
|
||||||
fetchRecord = ConcurrentRecord(rateIndex > 0, System.currentTimeMillis(), 1)
|
synchronized(concurrentRecordMap) {
|
||||||
concurrentRecordMap[source.getKey()] = fetchRecord
|
fetchRecord = concurrentRecordMap[source.getKey()]
|
||||||
return fetchRecord
|
if (fetchRecord == null) {
|
||||||
|
fetchRecord = ConcurrentRecord(rateIndex > 0, System.currentTimeMillis(), 1)
|
||||||
|
concurrentRecordMap[source.getKey()] = fetchRecord
|
||||||
|
return fetchRecord
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val waitTime: Int = synchronized(fetchRecord) {
|
val waitTime: Int = synchronized(fetchRecord!!) {
|
||||||
try {
|
try {
|
||||||
if (!fetchRecord.isConcurrent) {
|
if (!fetchRecord.isConcurrent) {
|
||||||
//并发控制非 次数/毫秒
|
//并发控制非 次数/毫秒
|
||||||
|
|||||||
Reference in New Issue
Block a user