From b65eb72e33cbc11a74c7c773c593fee188e59f98 Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 14 Jun 2026 18:29:50 +0800 Subject: [PATCH 1/4] Move subscription info fetch into Go --- core/src/main/golang/native/config/fetch.go | 95 ++++++++-- .../kr328/clash/core/model/FetchStatus.kt | 6 + service/build.gradle.kts | 2 - .../kr328/clash/service/ProfileManager.kt | 33 ---- .../kr328/clash/service/ProfileProcessor.kt | 167 ++++++++---------- .../service/util/SubscriptionUserInfo.kt | 49 ----- .../clash/profile/vm/PropertiesViewModel.kt | 1 + 7 files changed, 166 insertions(+), 187 deletions(-) delete mode 100644 service/src/main/kotlin/com/github/kr328/clash/service/util/SubscriptionUserInfo.kt diff --git a/core/src/main/golang/native/config/fetch.go b/core/src/main/golang/native/config/fetch.go index b115320cf7..3224a2f87f 100644 --- a/core/src/main/golang/native/config/fetch.go +++ b/core/src/main/golang/native/config/fetch.go @@ -10,45 +10,62 @@ import ( "os" P "path" "runtime" + "strconv" + "strings" "time" "cfa/native/app" + "github.com/metacubex/mihomo/adapter/provider" clashHttp "github.com/metacubex/mihomo/component/http" RB "github.com/metacubex/mihomo/rules/bundle" ) type Status struct { - Action string `json:"action"` - Args []string `json:"args"` - Progress int `json:"progress"` - MaxProgress int `json:"max"` + Action string `json:"action"` + Args []string `json:"args"` + Progress int `json:"progress"` + MaxProgress int `json:"max"` + SubUpload *int64 `json:"subUpload,omitempty"` + SubDownload *int64 `json:"subDownload,omitempty"` + SubTotal *int64 `json:"subTotal,omitempty"` + SubExpire *int64 `json:"subExpire,omitempty"` + SubUpdateInterval *int64 `json:"subUpdateInterval,omitempty"` } -func openUrl(ctx context.Context, url string) (io.ReadCloser, error) { +type fetchHeader struct { + SubscriptionUserInfo string + ProfileUpdateInterval string +} + +func openUrl(ctx context.Context, url string) (io.ReadCloser, fetchHeader, error) { response, err := clashHttp.HttpRequest(ctx, url, http.MethodGet, http.Header{"User-Agent": {"Tabby/" + app.VersionName()}}, nil) if err != nil { - return nil, err + return nil, fetchHeader{}, err } - return response.Body, nil + return response.Body, fetchHeader{ + SubscriptionUserInfo: response.Header.Get("subscription-userinfo"), + ProfileUpdateInterval: response.Header.Get("profile-update-interval"), + }, nil } func openContent(url string) (io.ReadCloser, error) { return app.OpenContent(url) } -func fetch(url *U.URL, file string) error { +func fetch(url *U.URL, file string) (fetchHeader, error) { ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) defer cancel() var reader io.ReadCloser + var header fetchHeader var err error switch url.Scheme { case "http", "https": - reader, err = openUrl(ctx, url.String()) + reader, header, err = openUrl(ctx, url.String()) case "content": reader, err = openContent(url.String()) default: @@ -56,12 +73,12 @@ func fetch(url *U.URL, file string) error { } if err != nil { - return err + return fetchHeader{}, err } defer reader.Close() - return writeFile(file, reader) + return header, writeFile(file, reader) } func writeFile(file string, reader io.Reader) error { @@ -82,6 +99,55 @@ func writeFile(file string, reader io.Reader) error { return err } +func parseProfileUpdateInterval(value string) (int64, bool) { + hours, err := strconv.ParseInt(strings.TrimSpace(value), 10, 64) + if err != nil { + return 0, false + } + + if hours <= 0 { + return 0, true + } + + interval := time.Duration(hours) * time.Hour + if interval < 15*time.Minute { + interval = 15 * time.Minute + } + + return int64(interval / time.Millisecond), true +} + +func reportSubscriptionInfo(header fetchHeader, reportStatus func(string)) { + userinfo := header.SubscriptionUserInfo + updateIntervalHeader := header.ProfileUpdateInterval + if userinfo == "" && updateIntervalHeader == "" { + return + } + + status := Status{ + Action: "SubscriptionInfo", + Args: []string{}, + Progress: -1, + MaxProgress: -1, + } + + if userinfo != "" { + info := provider.NewSubscriptionInfo(userinfo) + expire := info.Expire * 1000 + status.SubUpload = &info.Upload + status.SubDownload = &info.Download + status.SubTotal = &info.Total + status.SubExpire = &expire + } + + if interval, ok := parseProfileUpdateInterval(updateIntervalHeader); ok { + status.SubUpdateInterval = &interval + } + + bytes, _ := json.Marshal(&status) + reportStatus(string(bytes)) +} + func FetchAndValid( path string, url string, @@ -105,9 +171,12 @@ func FetchAndValid( reportStatus(string(bytes)) - if err := fetch(url, configPath); err != nil { + header, err := fetch(url, configPath) + if err != nil { return err } + + reportSubscriptionInfo(header, reportStatus) } defer runtime.GC() @@ -166,7 +235,7 @@ func FetchAndValid( } } - _ = fetch(url, ps) + _, _ = fetch(url, ps) }) bytes, _ := json.Marshal(&Status{ diff --git a/core/src/main/kotlin/com/github/kr328/clash/core/model/FetchStatus.kt b/core/src/main/kotlin/com/github/kr328/clash/core/model/FetchStatus.kt index 7425e95578..b4cd0c05b9 100644 --- a/core/src/main/kotlin/com/github/kr328/clash/core/model/FetchStatus.kt +++ b/core/src/main/kotlin/com/github/kr328/clash/core/model/FetchStatus.kt @@ -11,10 +11,16 @@ data class FetchStatus( val args: List, val progress: Int, val max: Int, + val subUpload: Long? = null, + val subDownload: Long? = null, + val subTotal: Long? = null, + val subExpire: Long? = null, + val subUpdateInterval: Long? = null, ) : Parcelable { enum class Action { FetchConfiguration, FetchProviders, + SubscriptionInfo, Verifying, } } diff --git a/service/build.gradle.kts b/service/build.gradle.kts index 691584a6ea..f71b6c5b67 100644 --- a/service/build.gradle.kts +++ b/service/build.gradle.kts @@ -15,8 +15,6 @@ dependencies { implementation(libs.androidx.room.runtime) implementation(libs.kaidl.runtime) implementation(libs.rikkax.multiprocess) - implementation(libs.okhttp.client) - implementation(libs.okhttp.interceptor) ksp(libs.kaidl.compiler) ksp(libs.androidx.room.compiler) diff --git a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileManager.kt b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileManager.kt index d37d2726c2..48c4556f31 100644 --- a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileManager.kt +++ b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileManager.kt @@ -12,7 +12,6 @@ import com.github.kr328.clash.service.remote.IFetchObserver import com.github.kr328.clash.service.remote.IProfileManager import com.github.kr328.clash.service.store.ServiceStore import com.github.kr328.clash.service.util.directoryLastModified -import com.github.kr328.clash.service.util.fetchSubscriptionUserInfo import com.github.kr328.clash.service.util.generateProfileUUID import com.github.kr328.clash.service.util.importedDir import com.github.kr328.clash.service.util.pendingDir @@ -146,38 +145,6 @@ class ProfileManager(private val context: Context) : override suspend fun update(uuid: Uuid) { scheduleUpdate(uuid, true) - ImportedDao().queryByUUID(uuid)?.let { - if (it.type == Profile.Type.Url && it.source.startsWith("https://", true)) { - updateFlow(it) - } - } - } - - suspend fun updateFlow(old: Imported) { - try { - val userInfo = context.fetchSubscriptionUserInfo(old.source) ?: return - val new = - Imported( - old.uuid, - old.name, - old.type, - old.source, - old.interval, - userInfo.upload, - userInfo.download, - userInfo.total, - userInfo.expire, - old.createdAt, - ageSecretKey = old.ageSecretKey, - ) - - ImportedDao().update(new) - - PendingDao().remove(new.uuid) - context.sendProfileChanged(new.uuid) - } catch (e: Exception) { - Log.e("Update profile flow failed: ${e.message}", e) - } } override suspend fun commit(uuid: Uuid, callback: IFetchObserver?) { diff --git a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt index 68c95519fc..11b1c61437 100644 --- a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt +++ b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt @@ -4,6 +4,7 @@ import android.content.Context import androidx.core.net.toUri import com.github.kr328.clash.common.log.Log import com.github.kr328.clash.core.Clash +import com.github.kr328.clash.core.model.FetchStatus import com.github.kr328.clash.service.data.Imported import com.github.kr328.clash.service.data.ImportedDao import com.github.kr328.clash.service.data.Pending @@ -11,7 +12,6 @@ import com.github.kr328.clash.service.data.PendingDao import com.github.kr328.clash.service.model.Profile import com.github.kr328.clash.service.remote.IFetchObserver import com.github.kr328.clash.service.store.ServiceStore -import com.github.kr328.clash.service.util.fetchSubscriptionUserInfo import com.github.kr328.clash.service.util.importedDir import com.github.kr328.clash.service.util.pendingDir import com.github.kr328.clash.service.util.processingDir @@ -49,22 +49,7 @@ object ProfileProcessor { } val force = snapshot.type != Profile.Type.File - var cb = callback - - Clash.fetchAndValid( - context.processingDir, - snapshot.source, - force, - snapshot.ageSecretKey?.takeIf { it.isNotBlank() }, - ) { - try { - cb?.updateStatus(it) - } catch (e: Exception) { - cb = null - - Log.w("Report fetch status: $e", e) - } - } + val subscriptionInfo = fetchProfile(context, snapshot.source, force, snapshot.ageSecretKey, callback) profileLock.withLock { if (PendingDao().queryByUUID(snapshot.uuid) == snapshot) { @@ -74,65 +59,36 @@ object ProfileProcessor { ) val old = ImportedDao().queryByUUID(snapshot.uuid) - if (snapshot.type == Profile.Type.Url) { - val userInfo = - if (snapshot.source.startsWith("https://", true)) { - context.fetchSubscriptionUserInfo(snapshot.source) - } else { - null - } - val new = - Imported( - snapshot.uuid, - snapshot.name, - snapshot.type, - snapshot.source, - snapshot.interval, - userInfo?.upload ?: 0, - userInfo?.download ?: 0, - userInfo?.total ?: 0, - userInfo?.expire ?: 0, - old?.createdAt ?: System.currentTimeMillis(), - ageSecretKey = snapshot.ageSecretKey, - ) - if (old != null) { - ImportedDao().update(new) - } else { - ImportedDao().insert(new) - } - - PendingDao().remove(snapshot.uuid) - - context.pendingDir.resolve(snapshot.uuid.toString()).deleteRecursively() - - context.sendProfileChanged(snapshot.uuid) - } else if (snapshot.type == Profile.Type.File) { - val new = - Imported( - snapshot.uuid, - snapshot.name, - snapshot.type, - snapshot.source, - snapshot.interval, - 0, - 0, - 0, - 0, - old?.createdAt ?: System.currentTimeMillis(), - ageSecretKey = snapshot.ageSecretKey, - ) - if (old != null) { - ImportedDao().update(new) - } else { - ImportedDao().insert(new) - } + val updateInterval = subscriptionInfo?.subUpdateInterval + ?.takeIf { old == null && snapshot.interval == 0L } + ?: snapshot.interval + + val new = + Imported( + snapshot.uuid, + snapshot.name, + snapshot.type, + snapshot.source, + updateInterval, + subscriptionInfo?.subUpload ?: 0, + subscriptionInfo?.subDownload ?: 0, + subscriptionInfo?.subTotal ?: 0, + subscriptionInfo?.subExpire ?: 0, + old?.createdAt ?: System.currentTimeMillis(), + ageSecretKey = snapshot.ageSecretKey, + ) + + if (old != null) { + ImportedDao().update(new) + } else { + ImportedDao().insert(new) + } - PendingDao().remove(snapshot.uuid) + PendingDao().remove(snapshot.uuid) - context.pendingDir.resolve(snapshot.uuid.toString()).deleteRecursively() + context.pendingDir.resolve(snapshot.uuid.toString()).deleteRecursively() - context.sendProfileChanged(snapshot.uuid) - } + context.sendProfileChanged(snapshot.uuid) } } } @@ -157,30 +113,28 @@ object ProfileProcessor { imported } - var cb = callback - - Clash.fetchAndValid( - context.processingDir, - snapshot.source, - true, - snapshot.ageSecretKey?.takeIf { it.isNotBlank() }, - ) { - try { - cb?.updateStatus(it) - } catch (e: Exception) { - cb = null - - Log.w("Report fetch status: $e", e) - } - } + val subscriptionInfo = fetchProfile(context, snapshot.source, true, snapshot.ageSecretKey, callback) profileLock.withLock { - if (ImportedDao().exists(snapshot.uuid)) { + val imported = ImportedDao().queryByUUID(snapshot.uuid) + if (imported != null) { context.importedDir.resolve(snapshot.uuid.toString()).deleteRecursively() context.processingDir.copyRecursively( context.importedDir.resolve(snapshot.uuid.toString()) ) + val upload = subscriptionInfo?.subUpload + if (upload != null) { + ImportedDao().update( + imported.copy( + upload = upload, + download = subscriptionInfo.subDownload ?: 0, + total = subscriptionInfo.subTotal ?: 0, + expire = subscriptionInfo.subExpire ?: 0, + ) + ) + } + context.sendProfileChanged(snapshot.uuid) } } @@ -188,6 +142,39 @@ object ProfileProcessor { } } + private suspend fun fetchProfile( + context: Context, + source: String, + force: Boolean, + ageSecretKey: String?, + callback: IFetchObserver?, + ): FetchStatus? { + var subscriptionInfo: FetchStatus? = null + var cb = callback + + Clash.fetchAndValid( + context.processingDir, + source, + force, + ageSecretKey?.takeIf { it.isNotBlank() }, + ) { + if (it.action == FetchStatus.Action.SubscriptionInfo) { + subscriptionInfo = it + return@fetchAndValid + } + + try { + cb?.updateStatus(it) + } catch (e: Exception) { + cb = null + + Log.w("Report fetch status: $e", e) + } + } + + return subscriptionInfo + } + suspend fun delete(context: Context, uuid: Uuid) { withContext(NonCancellable) { profileLock.withLock { diff --git a/service/src/main/kotlin/com/github/kr328/clash/service/util/SubscriptionUserInfo.kt b/service/src/main/kotlin/com/github/kr328/clash/service/util/SubscriptionUserInfo.kt deleted file mode 100644 index 8ca4860874..0000000000 --- a/service/src/main/kotlin/com/github/kr328/clash/service/util/SubscriptionUserInfo.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.github.kr328.clash.service.util - -import android.content.Context -import okhttp3.OkHttpClient -import okhttp3.Request - -data class SubscriptionUserInfo( - val upload: Long, - val download: Long, - val total: Long, - val expire: Long, -) - -fun Context.fetchSubscriptionUserInfo(source: String): SubscriptionUserInfo? { - val versionName = packageManager.getPackageInfo(packageName, 0).versionName - val request = Request.Builder().url(source).header("User-Agent", "Tabby/$versionName").build() - - OkHttpClient().newCall(request).execute().use { response -> - if (!response.isSuccessful) return null - val userinfo = response.headers["subscription-userinfo"] ?: return null - return parseSubscriptionUserInfo(userinfo) - } -} - -private fun parseSubscriptionUserInfo(userinfo: String): SubscriptionUserInfo { - var upload: Long = 0 - var download: Long = 0 - var total: Long = 0 - var expire: Long = 0 - - val flags = userinfo.split(";") - for (flag in flags) { - val (key, value) = flag.split("=") - when { - key.contains("upload") && value.isNotEmpty() -> - upload = value.split('.').first().toBigDecimal().longValueExact() - - key.contains("download") && value.isNotEmpty() -> - download = value.split('.').first().toBigDecimal().longValueExact() - - key.contains("total") && value.isNotEmpty() -> - total = value.split('.').first().toBigDecimal().longValueExact() - - key.contains("expire") && value.isNotEmpty() -> expire = (value.toDouble() * 1000L).toLong() - } - } - - return SubscriptionUserInfo(upload = upload, download = download, total = total, expire = expire) -} diff --git a/ui/profile/src/androidMain/kotlin/com/github/kr328/clash/profile/vm/PropertiesViewModel.kt b/ui/profile/src/androidMain/kotlin/com/github/kr328/clash/profile/vm/PropertiesViewModel.kt index 77a37d83af..06e4c5ee85 100644 --- a/ui/profile/src/androidMain/kotlin/com/github/kr328/clash/profile/vm/PropertiesViewModel.kt +++ b/ui/profile/src/androidMain/kotlin/com/github/kr328/clash/profile/vm/PropertiesViewModel.kt @@ -245,6 +245,7 @@ internal class PropertiesViewModel( progress = status.progress, ) } + SubscriptionInfo -> current.progress } current.copy(progress = newProgress) } From 8a0dcc9d3f64e8a240c13500dcccc55c776b9d5a Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 14 Jun 2026 18:34:48 +0800 Subject: [PATCH 2/4] Make FetchStatus properties non-nullable Long with default 0 --- .../com/github/kr328/clash/core/model/FetchStatus.kt | 10 +++++----- .../github/kr328/clash/service/ProfileProcessor.kt | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/src/main/kotlin/com/github/kr328/clash/core/model/FetchStatus.kt b/core/src/main/kotlin/com/github/kr328/clash/core/model/FetchStatus.kt index b4cd0c05b9..9e44481047 100644 --- a/core/src/main/kotlin/com/github/kr328/clash/core/model/FetchStatus.kt +++ b/core/src/main/kotlin/com/github/kr328/clash/core/model/FetchStatus.kt @@ -11,11 +11,11 @@ data class FetchStatus( val args: List, val progress: Int, val max: Int, - val subUpload: Long? = null, - val subDownload: Long? = null, - val subTotal: Long? = null, - val subExpire: Long? = null, - val subUpdateInterval: Long? = null, + val subUpload: Long = 0L, + val subDownload: Long = 0L, + val subTotal: Long = 0L, + val subExpire: Long = 0L, + val subUpdateInterval: Long = 0L, ) : Parcelable { enum class Action { FetchConfiguration, diff --git a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt index 11b1c61437..4cdf54308d 100644 --- a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt +++ b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt @@ -123,14 +123,13 @@ object ProfileProcessor { context.importedDir.resolve(snapshot.uuid.toString()) ) - val upload = subscriptionInfo?.subUpload - if (upload != null) { + if (subscriptionInfo != null && subscriptionInfo.subTotal > 0) { ImportedDao().update( imported.copy( - upload = upload, - download = subscriptionInfo.subDownload ?: 0, - total = subscriptionInfo.subTotal ?: 0, - expire = subscriptionInfo.subExpire ?: 0, + upload = subscriptionInfo.subUpload, + download = subscriptionInfo.subDownload, + total = subscriptionInfo.subTotal, + expire = subscriptionInfo.subExpire, ) ) } From 4e4e5179d6e7cfe81fe163d2e494e6df0fcbb2ec Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 14 Jun 2026 18:36:18 +0800 Subject: [PATCH 3/4] Fix style --- .../kr328/clash/service/ProfileManager.kt | 3 --- .../kr328/clash/service/ProfileProcessor.kt | 27 ++++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileManager.kt b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileManager.kt index 48c4556f31..ae4b4adbf9 100644 --- a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileManager.kt +++ b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileManager.kt @@ -1,9 +1,7 @@ package com.github.kr328.clash.service import android.content.Context -import com.github.kr328.clash.common.log.Log import com.github.kr328.clash.service.data.Database -import com.github.kr328.clash.service.data.Imported import com.github.kr328.clash.service.data.ImportedDao import com.github.kr328.clash.service.data.Pending import com.github.kr328.clash.service.data.PendingDao @@ -15,7 +13,6 @@ import com.github.kr328.clash.service.util.directoryLastModified import com.github.kr328.clash.service.util.generateProfileUUID import com.github.kr328.clash.service.util.importedDir import com.github.kr328.clash.service.util.pendingDir -import com.github.kr328.clash.service.util.sendProfileChanged import java.io.FileNotFoundException import kotlin.uuid.Uuid import kotlinx.coroutines.CoroutineScope diff --git a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt index 4cdf54308d..4aa4e78ce4 100644 --- a/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt +++ b/service/src/main/kotlin/com/github/kr328/clash/service/ProfileProcessor.kt @@ -49,7 +49,8 @@ object ProfileProcessor { } val force = snapshot.type != Profile.Type.File - val subscriptionInfo = fetchProfile(context, snapshot.source, force, snapshot.ageSecretKey, callback) + val subscriptionInfo = + fetchProfile(context, snapshot.source, force, snapshot.ageSecretKey, callback) profileLock.withLock { if (PendingDao().queryByUUID(snapshot.uuid) == snapshot) { @@ -59,9 +60,9 @@ object ProfileProcessor { ) val old = ImportedDao().queryByUUID(snapshot.uuid) - val updateInterval = subscriptionInfo?.subUpdateInterval - ?.takeIf { old == null && snapshot.interval == 0L } - ?: snapshot.interval + val updateInterval = + subscriptionInfo?.subUpdateInterval?.takeIf { old == null && snapshot.interval == 0L } + ?: snapshot.interval val new = Imported( @@ -113,7 +114,8 @@ object ProfileProcessor { imported } - val subscriptionInfo = fetchProfile(context, snapshot.source, true, snapshot.ageSecretKey, callback) + val subscriptionInfo = + fetchProfile(context, snapshot.source, true, snapshot.ageSecretKey, callback) profileLock.withLock { val imported = ImportedDao().queryByUUID(snapshot.uuid) @@ -124,14 +126,15 @@ object ProfileProcessor { ) if (subscriptionInfo != null && subscriptionInfo.subTotal > 0) { - ImportedDao().update( - imported.copy( - upload = subscriptionInfo.subUpload, - download = subscriptionInfo.subDownload, - total = subscriptionInfo.subTotal, - expire = subscriptionInfo.subExpire, + ImportedDao() + .update( + imported.copy( + upload = subscriptionInfo.subUpload, + download = subscriptionInfo.subDownload, + total = subscriptionInfo.subTotal, + expire = subscriptionInfo.subExpire, + ) ) - ) } context.sendProfileChanged(snapshot.uuid) From c11181299a926bb5528d761876c8344fde12926a Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 14 Jun 2026 18:43:27 +0800 Subject: [PATCH 4/4] Remove dead clamp check in parseProfileUpdateInterval --- core/src/main/golang/native/config/fetch.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/main/golang/native/config/fetch.go b/core/src/main/golang/native/config/fetch.go index 3224a2f87f..8c93279b13 100644 --- a/core/src/main/golang/native/config/fetch.go +++ b/core/src/main/golang/native/config/fetch.go @@ -99,6 +99,7 @@ func writeFile(file string, reader io.Reader) error { return err } +// parseProfileUpdateInterval parses the profile update interval (in hours) from the header. func parseProfileUpdateInterval(value string) (int64, bool) { hours, err := strconv.ParseInt(strings.TrimSpace(value), 10, 64) if err != nil { @@ -110,9 +111,6 @@ func parseProfileUpdateInterval(value string) (int64, bool) { } interval := time.Duration(hours) * time.Hour - if interval < 15*time.Minute { - interval = 15 * time.Minute - } return int64(interval / time.Millisecond), true }