Skip to content

Commit

Permalink
Merge pull request #5043 from royalhuang/issue_4885
Browse files Browse the repository at this point in the history
feat: 签名模块后台逻辑优化 #4885
  • Loading branch information
irwinsun authored Aug 30, 2021
2 parents b21ab4e + b4e1323 commit 29f2041
Show file tree
Hide file tree
Showing 14 changed files with 243 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ object SignMessageCode {
const val ERROR_NOT_AUTH_UPLOAD = "2122016" // 无发起iOS重签名权限
const val ERROR_UPLOAD_TOKEN_INVALID = "2122017" // 上传IPA使用的token不存在
const val ERROR_UPLOAD_TOKEN_EXPIRED = "2122018" // 上传IPA使用的token已过期
const val ERROR_MP_PARSE_ERROR = "2122019" // 描述文件不存在
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,7 @@ data class IpaSignInfo(
@ApiModelProperty("拓展应用名和对应的描述文件ID", required = false)
var appexSignInfo: List<AppexSignInfo>? = null,
@ApiModelProperty("待替换的plist信息", required = false)
var replaceKeyList: Map<String, String>? = null
var replaceKeyList: Map<String, String>? = null,
@ApiModelProperty("指定xcode签名工具版本", required = false)
var codeSignVersion: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ class ArchiveServiceImpl @Autowired constructor(
return false
}
}
} catch (e: Exception) {
logger.error("artifactory upload file with error. url:$url", e)
} catch (ignore: Throwable) {
logger.error("artifactory upload file with error. url:$url", ignore)
return false
}
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,30 @@ import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy

@Configuration
@EnableAsync
@Suppress("ALL")
class SignExecutorConfig {

@Bean(name = ["asyncSignExecutor"])
fun asyncExecutor(): Executor {
val executor = ThreadPoolTaskExecutor()
executor.corePoolSize = 10
executor.maxPoolSize = 15
executor.setQueueCapacity(25)
executor.keepAliveSeconds = 200
executor.corePoolSize = CORE_POOL_SIZE
executor.maxPoolSize = MAX_POOL_SIZE
executor.setQueueCapacity(QUEUE_CAPACITY_SIZE)
executor.keepAliveSeconds = KEEP_ALIVE_SECONDS
executor.threadNamePrefix = "asyncSign-"
executor.setRejectedExecutionHandler(CallerRunsPolicy())
// 等待所有任务都完成再继续销毁其他的Bean
executor.setWaitForTasksToCompleteOnShutdown(true)
// 线程池中任务的等待时间,如果超过这个时候还没有销毁就强制销毁,以确保应用最后能够被关闭,而不是阻塞住
executor.setAwaitTerminationSeconds(60)
executor.setAwaitTerminationSeconds(TERMINATION_SECONDS)
executor.initialize()
return executor
}

companion object {
const val CORE_POOL_SIZE = 10
const val MAX_POOL_SIZE = 15
const val QUEUE_CAPACITY_SIZE = 25
const val KEEP_ALIVE_SECONDS = 200
const val TERMINATION_SECONDS = 60
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import org.springframework.stereotype.Repository
import java.time.LocalDateTime

@Repository
@Suppress("ALL")
class IpaUploadDao {

@Suppress("LongParameterList")
fun save(
dslContext: DSLContext,
userId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import org.springframework.stereotype.Repository
import java.time.LocalDateTime

@Repository
@Suppress("ALL")
class SignHistoryDao {

@Suppress("LongParameterList")
fun initHistory(
dslContext: DSLContext,
resignId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import org.springframework.stereotype.Repository
import com.fasterxml.jackson.module.kotlin.readValue

@Repository
@Suppress("ALL")
class SignIpaInfoDao {

fun saveSignInfo(
Expand Down Expand Up @@ -129,16 +128,4 @@ class SignIpaInfoDao {
)
}
}

fun getSignInfoContent(
dslContext: DSLContext,
resignId: String
): String? {
with(TSignIpaInfo.T_SIGN_IPA_INFO) {
val record = dslContext.selectFrom(this)
.where(RESIGN_ID.eq(resignId))
.fetchOne()
return record?.requestContent
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import java.io.File
import java.io.InputStream

@Service
@Suppress("ALL")
class FileServiceImpl : FileService {

@Value("\${bkci.sign.tmpDir:/data/enterprise_sign_tmp}")
Expand Down Expand Up @@ -111,6 +110,7 @@ class FileServiceImpl : FileService {
ipaSignInfo: IpaSignInfo,
resignId: String?
): File {
return File("$tmpDir/${ipaSignInfo.projectId}/${ipaSignInfo.pipelineId}/${ipaSignInfo.buildId}/$resignId/")
return File("$tmpDir/${ipaSignInfo.projectId}/${ipaSignInfo.pipelineId}" +
"/${ipaSignInfo.buildId}/$resignId/")
}
}
Loading

0 comments on commit 29f2041

Please sign in to comment.