diff --git a/src/internal/ratelimit/ratelimit.go b/src/internal/ratelimit/ratelimit.go index bfde41a67..6fc06490f 100644 --- a/src/internal/ratelimit/ratelimit.go +++ b/src/internal/ratelimit/ratelimit.go @@ -15,9 +15,9 @@ const UPGRADE_DELIVERY_SERVICE = "org.deepin.upgradedelivery" const UPGRADE_DELIVERY_OBJECT_PATH = "/org/deepin/upgradedelivery" const UPGRADE_DELIVERY_INTERFACE = "org.deepin.upgradedelivery" -const DefaultRateLimit = 10 * 1024 // 10KB/s unit: bytes per second -const MinRateLimit = 10 * 1024 // 10KB/s unit: bytes per second -const MaxRateLimit = 999999 * 1024 // 999999KB/s unit: bytes per second +const DefaultRateLimit = 10240 * 1024 // 10240KB/s unit: bytes per second +const MinRateLimit = 10 * 1024 // 10KB/s unit: bytes per second +const MaxRateLimit = 999999 * 1024 // 999999KB/s unit: bytes per second // SyncLimit 服务器端限速配置信息 type SyncLimit struct { diff --git a/src/internal/updateplatform/message_report.go b/src/internal/updateplatform/message_report.go index 987844999..d87c9ca48 100644 --- a/src/internal/updateplatform/message_report.go +++ b/src/internal/updateplatform/message_report.go @@ -46,7 +46,7 @@ const defaultPlatformRepoComponents = "main community commercial" var setIPFSRateLimit = ratelimit.SetIPFSRateLimit const defaultDownloadSpeedLimitConfig = `{"DownloadSpeedLimitEnabled":false,"LimitSpeed":"1024","IsOnlineSpeedLimit":false}` -const defaultDeliveryRateLimitConfig = `{"LimitType":0,"StartTime":"0001-01-01T00:00:00Z","EndTime":"0001-01-01T00:00:00Z","LimitRate":10240,"CurrentRate":10240}` +const defaultDeliveryRateLimitConfig = `{"LimitType":0,"StartTime":"0001-01-01T00:00:00Z","EndTime":"0001-01-01T00:00:00Z","LimitRate":10485760,"CurrentRate":10485760}` type ProcessEvent struct { TaskID int `json:"taskID"` diff --git a/src/internal/updateplatform/message_report_test.go b/src/internal/updateplatform/message_report_test.go index 3d053a4c9..4d9073686 100644 --- a/src/internal/updateplatform/message_report_test.go +++ b/src/internal/updateplatform/message_report_test.go @@ -289,6 +289,12 @@ func TestResetIntranetUpdateSettingsAfterUnregisterEnablesDeliveryAndDisablesSpe if rateInfo.LimitType != ratelimit.RateLimitTypeNo { t.Fatalf("%s LimitType = %d, want %d", name, rateInfo.LimitType, ratelimit.RateLimitTypeNo) } + if rateInfo.LimitRate != ratelimit.DefaultRateLimit { + t.Fatalf("%s LimitRate = %d, want %d", name, rateInfo.LimitRate, ratelimit.DefaultRateLimit) + } + if rateInfo.CurrentRate != ratelimit.DefaultRateLimit { + t.Fatalf("%s CurrentRate = %d, want %d", name, rateInfo.CurrentRate, ratelimit.DefaultRateLimit) + } } assertNoIPFSLimitRate(t, "upload", gotUpload) assertNoIPFSLimitRate(t, "download", gotDownload) diff --git a/usr/share/dsg/configs/org.deepin.dde.lastore/org.deepin.dde.lastore.json b/usr/share/dsg/configs/org.deepin.dde.lastore/org.deepin.dde.lastore.json index f1a657844..2b185eb31 100644 --- a/usr/share/dsg/configs/org.deepin.dde.lastore/org.deepin.dde.lastore.json +++ b/usr/share/dsg/configs/org.deepin.dde.lastore/org.deepin.dde.lastore.json @@ -636,7 +636,7 @@ "visibility": "private" }, "delivery-remote-download-global-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -649,7 +649,7 @@ "visibility": "private" }, "delivery-remote-upload-global-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -662,7 +662,7 @@ "visibility": "private" }, "delivery-remote-download-peak-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -675,7 +675,7 @@ "visibility": "private" }, "delivery-remote-upload-peak-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -688,7 +688,7 @@ "visibility": "private" }, "delivery-remote-download-offpeak-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -701,7 +701,7 @@ "visibility": "private" }, "delivery-remote-upload-offpeak-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -714,7 +714,7 @@ "visibility": "private" }, "delivery-local-download-global-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -727,7 +727,7 @@ "visibility": "private" }, "delivery-local-upload-global-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -740,7 +740,7 @@ "visibility": "private" }, "delivery-local-download-peak-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -753,7 +753,7 @@ "visibility": "private" }, "delivery-local-upload-peak-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -766,7 +766,7 @@ "visibility": "private" }, "delivery-local-download-offpeak-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global" @@ -779,7 +779,7 @@ "visibility": "private" }, "delivery-local-upload-offpeak-limit": { - "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10240,\"CurrentRate\":10240}", + "value": "{\"LimitType\":0,\"StartTime\":\"0001-01-01T00:00:00Z\",\"EndTime\":\"0001-01-01T00:00:00Z\",\"LimitRate\":10485760,\"CurrentRate\":10485760}", "serial": 0, "flags": [ "global"