This commit is contained in:
Horis
2024-09-24 12:29:14 +08:00
parent 6df00e9f49
commit 80a359ba5a
@@ -319,12 +319,17 @@ class AnalyzeUrl(
} }
val rateIndex = concurrentRate.indexOf("/") val rateIndex = concurrentRate.indexOf("/")
var fetchRecord = concurrentRecordMap[source.getKey()] var fetchRecord = concurrentRecordMap[source.getKey()]
if (fetchRecord == null) {
synchronized(concurrentRecordMap) {
fetchRecord = concurrentRecordMap[source.getKey()]
if (fetchRecord == null) { if (fetchRecord == null) {
fetchRecord = ConcurrentRecord(rateIndex > 0, System.currentTimeMillis(), 1) fetchRecord = ConcurrentRecord(rateIndex > 0, System.currentTimeMillis(), 1)
concurrentRecordMap[source.getKey()] = fetchRecord concurrentRecordMap[source.getKey()] = fetchRecord
return fetchRecord return fetchRecord
} }
val waitTime: Int = synchronized(fetchRecord) { }
}
val waitTime: Int = synchronized(fetchRecord!!) {
try { try {
if (!fetchRecord.isConcurrent) { if (!fetchRecord.isConcurrent) {
//并发控制非 次数/毫秒 //并发控制非 次数/毫秒