Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/internal/ratelimit/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/updateplatform/message_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
6 changes: 6 additions & 0 deletions src/internal/updateplatform/message_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
Loading