get10101 / 10101

10101 (Ten-Ten-One): Self-custodial derivative trading at your fingertips.
https://10101.finance
MIT License
124 stars 21 forks source link

Add `unique_end_date` constraint to `funding_rates` table #2615

Closed luckysori closed 1 month ago

luckysori commented 1 month ago

We only need one funding rate entry per end_date.

Without this change we were getting a new duplicate entry per maker restart.

holzeis commented 1 month ago

What will happen if we get a duplicate entry. Is the error simply logged?

luckysori commented 1 month ago

What will happen if we get a duplicate entry. Is the error simply logged?

Good question.

An error would be logged, but it would also mean that any other rows in the batch would be ignored. I've updated the patch to fix this: https://github.com/get10101/10101/compare/fc36c9a54b22eeda84dccf463a872bc9c7b53543..23ac948ab64eda8cbe7a06abd343a0b62feb42f9.