storj/satellite
Ivan Fraixedes f626cd1868 satellite/accounting: Correctly cache project bandwidth
Satellite caches the project bandwidth in Redis when it doesn't have it
because was not set or the key expired, however, it doesn't perform the
check and set if not exists in a transaction. It also uses the increase
function which increases the value if it exists otherwise it sets it.

This provokes that multiple concurrent request to the same project may
increase the total project by multiples of the bandwidth usage
registered in the database rather than setting it because they may check
if the key exists before any other has executed the increase and then
the first one executing it will set the value but the others will
increased causing that Redis has a wrong bandwidth usage value which is
N magnitude of the real one and making the satellite to deny the
downloading if it surpasses the project limit.

This commit changes the "update"" project bandwidth usage by an "insert"
but using a Redis function that only sets the value if the key doesn't
exists for solving the increase issue but also not overriding the value
due to may contain updates of other downloading requests which aren't
already registered in the DB.

Change-Id: I33e2fe462930b2fdb4061fc94002bd3544476f94
2022-06-21 08:31:41 +00:00
..
accounting satellite/accounting: Correctly cache project bandwidth 2022-06-21 08:31:41 +00:00
admin satellite/console: use new type UpdateUserRequest as arg to db users.Update 2022-06-14 09:28:03 -04:00
analytics satellite/analytics: Added tracks calls for product activity metrics (#4907) 2022-06-17 12:57:10 -07:00
attribution {cmd/satellite/reports, satellite/attribution}: type and variable name adjustments 2022-04-26 20:12:38 +00:00
audit satellite/reputation: new ApplyUpdates() method 2022-06-07 15:22:25 +00:00
buckets satellite/metainfo: propagate geofencing between buckets and stream id 2021-11-24 08:05:05 +00:00
compensation satellite/compensation: add a code that crypthopper-go now uses 2022-04-25 10:46:51 +00:00
console satellite/analytics: Added tracks calls for product activity metrics (#4907) 2022-06-17 12:57:10 -07:00
contact satellite/contact: swap net.IP.IsPrivateIP with isPrivateIP 2022-06-13 01:01:44 +02:00
gc satellite: use more optimal monkit call for loop observers methods 2022-05-20 11:03:41 +00:00
geoip satellite/geoip: update node check-in to associate a country code 2021-11-10 16:44:41 +01:00
gracefulexit satellite: use more optimal monkit call for loop observers methods 2022-05-20 11:03:41 +00:00
inspector satellite/metabase: drop GetObjectLatestVersion method 2022-02-02 09:40:53 +00:00
internalpb satellite/reputation: don't need 3 identical AuditHistory types 2022-05-24 05:48:46 +00:00
mailservice satellite/{mailservice,oidc}: improvements to debugging 2022-05-11 19:59:42 +00:00
metabase satellite/metabase: FinishMoveObject cheks for empty metadata 2022-06-17 08:24:24 +00:00
metainfo satellite/console: integrate sessions into satellite UI 2022-06-13 08:02:02 +00:00
metrics satellite/{audit,metrics}: optimize loop methods 2022-05-05 15:10:56 +00:00
nodeapiversion satellite/nodeapiversion: new table for tracking node api usage 2020-07-09 15:02:25 +00:00
nodeselection/uploadselection satellite/repairer: handle excluded countries 2022-03-14 10:59:36 -04:00
nodestats satellite/reputation: don't need 3 identical AuditHistory types 2022-05-24 05:48:46 +00:00
oidc satellite/console: integrate sessions into satellite UI 2022-06-13 08:02:02 +00:00
orders satellite: use PieceIDDeriver for derivation 2022-05-19 06:31:42 +00:00
overlay satellite/overlay: fix TestNodeSelectionGracefulExit 2022-06-17 18:28:04 +00:00
payments satellite/payments/storjscan: add chore to periodically ask for new payments 2022-06-16 09:38:37 +01:00
repair satellite: use more optimal monkit call for loop observers methods 2022-05-20 11:03:41 +00:00
reputation satellite/reputation: new ApplyUpdates() method 2022-06-07 15:22:25 +00:00
revocation satellite/satellitedb: move tests to their domains 2021-02-19 17:29:15 +02:00
rewards satellite/rewards: adding SeaweedFS to partners list (#4230) 2021-10-19 21:30:31 +02:00
satellitedb satellite/satellitedb: use tx instead of db.db in transactions 2022-06-14 17:35:44 +00:00
snopayouts all: fix error naming 2021-04-29 15:38:21 +03:00
admin.go satellite/admin: fix console config handling 2022-05-27 22:26:06 +00:00
api.go satellite/payments/storjscan: update config and wrap service errors 2022-06-07 14:21:42 +00:00
configlock_test.go all: fix linter complaints 2020-10-13 15:59:01 +03:00
core.go satellite/core.go: hook up flag to enable email reminders 2022-05-27 13:16:14 -04:00
gc.go satellite: more detailed goroutine labels 2022-05-11 17:50:55 +00:00
peer.go satellite/payments/storjscan: add payments DB 2022-06-10 13:44:27 +01:00
repairer.go satellite: more detailed goroutine labels 2022-05-11 17:50:55 +00:00