Commit Graph

94 Commits

Author SHA1 Message Date
yenicelik
627c359645 mixed up directions 2023-06-25 21:19:13 -04:00
yenicelik
bbdff1d916 some code got lost in all the commits, deploying again 2023-06-25 21:02:07 -04:00
David
0f4d12e2a5
Merge pull request #149 from yenicelik/devel
Devel
2023-06-25 17:55:55 -04:00
Bryan Stitt
0aa94d9c87 don't escape newlines 2023-06-25 14:34:19 -07:00
yenicelik
32156e981d adding balances 2023-06-25 17:19:31 -04:00
yenicelik
992860a46d forgot to allow aggregate global stats 2023-06-25 16:18:09 -04:00
yenicelik
4c157cfcf7 made paymentrequired error code instead of introducing a new one 2023-06-25 15:05:27 -04:00
yenicelik
935681fde7 stats subuser + premium access logic 2023-06-25 14:29:54 -04:00
Bryan Stitt
1d6e1ef9af polish error logs 2023-06-24 15:24:46 -07:00
Bryan Stitt
fef03f089f less verbose db_conn and db_replica helpers 2023-06-24 11:11:07 -07:00
Bryan Stitt
91cbce6ce8 start adding stat for CU 2023-06-24 00:48:56 -07:00
Bryan Stitt
fd661689a3
Tracing (#144)
* tracing

* add tracing and features to match

* use just one hostname crate

* cargo upgrade

* set up pretty logger and sentry layer
2023-06-23 16:28:45 -07:00
Bryan Stitt
3c2f95de10
Improve max wait and timeouts (#137)
* pass max wait with more functions

* move rpc_head_str higher up to use it in all the logs

* refresh consensus at double the block time

* new pricing that also includes archive check

* lint

* don't clone method

* put caches into one list

they serialize with their name, so it will still be easy to tell them apart

* more consistent waiting. still waits more than I want right now

* clean up default max waits

* more timeouts
2023-06-20 14:22:14 -07:00
Bryan Stitt
6d25c41faf
Compute units (#136)
* wip

* add basic compute unit calculator

* calculate costs with compute units
2023-06-19 17:47:38 -07:00
Bryan Stitt
6038351cb8 change default tracking in prep for premium-only keys 2023-06-19 13:00:57 -07:00
Bryan Stitt
9b9e5341cb lint 2023-06-17 08:44:07 -07:00
Bryan Stitt
8ffd7d2e1b enable more advanced cost calculation 2023-06-16 23:55:41 -07:00
Bryan Stitt
ba67151706 lint 2023-06-16 23:48:16 -07:00
Bryan Stitt
745870d119 drop a bunch of log levels 2023-06-16 23:46:20 -07:00
Bryan Stitt
74d2333039 try this version of influxdb2 2023-06-16 23:41:12 -07:00
David
d6513cde74
Forgot to handle Option unwrap (#132)
* made the query much faster

* aggregate queries should be fast now too

* forgot to handle an option unwrap
2023-06-16 23:18:51 -07:00
Bryan Stitt
86f9e7358a
move balance onto AuthorizationChecks (#131)
* move balance onto AuthorizationChecks

* todone

* bigger default

* flat cost for testing
2023-06-16 23:14:43 -07:00
David
4772166e97
Make aggregate queries faster as well (#130)
* made the query much faster

* aggregate queries should be fast now too
2023-06-16 08:27:46 -07:00
David
5859cd8a8d
made the query much faster (#127) 2023-06-15 09:38:51 -07:00
yenicelik
2333b8bbb6 influx query is not 20-40% faster 2023-06-11 17:57:02 +02:00
Bryan Stitt
4a9c1a0ce6 move user registration into a dedicated function 2023-06-09 18:31:47 -07:00
David
d91713e09e
this brings back balance back to the stats request (#112)
* removed bloom filter temporarily, added some fixes with decimals in payment.rs

* balance is inside the influx query again

* fixed aggregate
2023-06-08 15:57:53 -07:00
Bryan Stitt
68f73ec0b1 more things should be BadRequest instead of 500 2023-06-08 13:42:45 -07:00
Bryan Stitt
50ec653557 lower log level 2023-06-08 11:46:38 -07:00
Bryan Stitt
74280bc329 lint 2023-06-08 11:33:16 -07:00
Bryan Stitt
334b1c21b3 improve logs 2023-06-08 11:30:48 -07:00
Bryan Stitt
1d05bc5e89 lower log levels 2023-06-08 11:26:09 -07:00
David
3f76b08364
Test balance and referral accounting (#111)
* removed bloom filter temporarily, added some fixes with decimals in payment.rs

* balance accounting for a single user (paid and free tier) seems to be ok

* fixed some balance accounting

* compute_cost reduced back to 0
2023-06-08 10:08:29 -07:00
Bryan Stitt
5c1569f9c2 clippy lint 2023-06-07 17:31:15 -07:00
Bryan Stitt
40bee30730 back to moka 2023-06-07 17:30:05 -07:00
David
de7d8919d3
Change balance to record total spend and total deposits (#109)
* lets test total deposit and total spent

* removed referrer from cache for performance reasons
2023-06-07 14:45:57 -07:00
Bryan Stitt
fb97ef5180 cargo clippy lints 2023-06-07 10:55:07 -07:00
David
63499c1564
David/66 downgrade balance logic (#89)
* tried to make the balance_entry atomic, asking for feedback

* added locked select everywhere and inside the txn, it should be atomic now

* forgot about overwrite (referee vs sender entities were the same, overwriting each other), fixed it

* will now trigger refreshing cache when balance thresholds are met

* will also invalidate cache if balance gets too low (to out of funds)

* added separate balance cache with shorter TTL. need to know if i should modify it (rn its not atomic), or if low TTL is good enough, and we just fetch the value every now and then from the Database

* removed UserTier struct bcs duplicate with database

* removed subuser premium requirement (which would have lead to a merge conflict later on)

* removed user_tier artefact

* replaced cache to use AtomicF64

* a bunch of small changes

* some changes

* will merge with devel

* changed AtomicF64 to RwLock<Decimal>

* changed AtomicF64 to RwLock<Decimal>

* downgrading user when at 0.1$ or if sum_credits_used is very low

* changed caches to be more aggressive in being non-empty

* replaced Arc::clone() by reference
2023-06-07 09:39:30 -07:00
David
f66edd961b
Making Balance Changes Atomic (Read and Write) (#84)
* tried to make the balance_entry atomic, asking for feedback

* added locked select everywhere and inside the txn, it should be atomic now

* forgot about overwrite (referee vs sender entities were the same, overwriting each other), fixed it

* will now trigger refreshing cache when balance thresholds are met

* Revert "will now trigger refreshing cache when balance thresholds are met"

This reverts commit b1215ddc43a1358f6086bddbd106996165431165.

* will not modify userTier in database anymore

* made payment atomic

* made updates mostly atomic, locking only the referral table (bcs more complex logic)

* latest changes
2023-06-04 09:32:53 -07:00
Bryan Stitt
79e52f4cdb Merge remote-tracking branch 'origin/main' into devel 2023-05-31 17:12:59 -07:00
Bryan Stitt
633bf1f53b need a decimal 0 2023-05-31 17:12:32 -07:00
Bryan Stitt
cb580d4ea8 Merge remote-tracking branch 'origin/main' into devel 2023-05-31 17:02:34 -07:00
Bryan Stitt
1a26260351 if no credits used, return early 2023-05-31 17:02:24 -07:00
Bryan Stitt
d64761403b Cow instead of String 2023-05-30 23:17:05 -07:00
Bryan Stitt
fd8bba4bdd most of these are for the whole app, not just the frontend 2023-05-30 21:26:11 -07:00
Bryan Stitt
cebe8ed1ea
Request refactor (#99)
* wip

* AsRef finally works like i wanted

* actually return the block

* start adding async trait

* remove stale import

* include id in the error response when possible

* remove stale comments
2023-05-30 16:32:34 -07:00
David
9a5e9d46a9
Merge branch 'devel' into david/devel/debug-graph 2023-05-24 13:36:45 +02:00
yenicelik
b6cab88c4e removed joined_on variable that was not used 2023-05-24 13:35:10 +02:00
yenicelik
47f07261ed detailed request must come with a bearer token 2023-05-24 13:34:50 +02:00
Bryan Stitt
d83e2f7015 Merge remote-tracking branch 'origin/devel' into devel 2023-05-23 14:44:40 -07:00