Skip to content

Commit e1fe366

Browse files
committed
fix:同时生成多个请求任务时,存在jobKey一样的情况,导致其他请求会被取消。
1 parent 2ce3cb1 commit e1fe366

6 files changed

Lines changed: 17 additions & 6 deletions

File tree

.idea/sonarlint/issuestore/0/9/09fc55d7b0e62b7c5cfc119d00304e17034b5a62

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/sonarlint/issuestore/e/f/ef64fd164d2083a14e4ffe5a00abb31194c0a8ef

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FlowHttp/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66

77
//ext.GROUP = "com.lute.network"
88
//ext.POM_ARTIFACT_ID = "NetCore-Flow"
9-
//ext.VERSION_NAME = "1.6.5"
9+
//ext.VERSION_NAME = "1.6.6"
1010
////引用gradle_upload.gradle
1111
//apply from: "${project.rootDir}/maven_upload.gradle"
1212

@@ -19,7 +19,7 @@ afterEvaluate {
1919
// 这里头是artifacts的配置信息,不填会采用默认的
2020
groupId = 'com.github.buhuiming'
2121
artifactId = 'NetCore-Flow'
22-
version = '1.6.5'
22+
version = '1.6.6'
2323

2424
from components.release
2525
artifact androidSourcesJar //打包源码,去除这行打的包将看不到源码

FlowHttp/src/main/java/com/bhm/network/core/HttpConfig.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,17 @@ class HttpConfig(builder: Builder) {
282282
fun writtenLength(): Long {
283283
return writtenLength
284284
}
285+
286+
private val characters = ('a'..'z') + ('A'..'Z') + ('0'..'9')
287+
288+
/**
289+
* 从[characters]中随机生成3个字符组成的字符串
290+
*/
291+
fun generateRandomString(): String {
292+
return (1..3)
293+
.map { characters.random() }
294+
.joinToString("")
295+
}
285296
}
286297

287298
init {

FlowHttp/src/main/java/com/bhm/network/core/HttpOptions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class HttpOptions(private val builder: Builder) {
106106
internal var dataKey = HttpConfig.dataKey
107107
internal var successCode = HttpConfig.successCode
108108
internal var parseDataKey = HttpConfig.parseDataKey
109-
internal var jobKey = System.currentTimeMillis().toString()
109+
internal var jobKey = System.currentTimeMillis().toString() + HttpConfig.generateRandomString()
110110
internal var noProxy = true
111111
internal var httpLogEvent = HttpConfig.httpLogEvent
112112
internal var cacheDuration: Long = HttpConfig.cacheDuration

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111

1212
dependencies {
13-
implementation 'com.github.buhuiming:NetCore-Flow:1.6.5'
13+
implementation 'com.github.buhuiming:NetCore-Flow:1.6.6'
1414
}
1515

1616
#### 1、Application配置默认的全局配置项(可选)

0 commit comments

Comments
 (0)