Skip to content

Commit

Permalink
Add await for user stat
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKhalili committed Dec 6, 2024
1 parent a5da3dd commit c81bcac
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions src/driftpy/user_map/userstats_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,32 @@
import os
import pickle
import traceback

from typing import Dict, Optional
import jsonrpcclient

from solders.pubkey import Pubkey
from driftpy.accounts.types import DataAndSlot

from driftpy.addresses import get_user_stats_account_public_key
from driftpy.drift_user_stats import DriftUserStats, UserStatsSubscriptionConfig
from driftpy.memcmp import get_user_stats_filter
from driftpy.types import (
NewUserRecord,
DepositRecord,
InsuranceFundStakeRecord,
LPRecord,
FundingPaymentRecord,
LiquidationRecord,
PickledData,
SettlePnlRecord,
OrderRecord,
OrderActionRecord,
UserStatsAccount,
compress,
decompress,
)
from driftpy.decode.user_stat import decode_user_stat
from driftpy.drift_user_stats import DriftUserStats
from driftpy.drift_user_stats import UserStatsSubscriptionConfig
from driftpy.events.types import WrappedEvent
from driftpy.user_map.user_map_config import UserStatsMapConfig
from driftpy.memcmp import get_user_stats_filter
from driftpy.types import compress
from driftpy.types import decompress
from driftpy.types import DepositRecord
from driftpy.types import FundingPaymentRecord
from driftpy.types import InsuranceFundStakeRecord
from driftpy.types import LiquidationRecord
from driftpy.types import LPRecord
from driftpy.types import NewUserRecord
from driftpy.types import OrderActionRecord
from driftpy.types import OrderRecord
from driftpy.types import PickledData
from driftpy.types import SettlePnlRecord
from driftpy.types import UserStatsAccount
from driftpy.user_map.user_map import UserMap
from driftpy.decode.user_stat import decode_user_stat
from driftpy.user_map.user_map_config import UserStatsMapConfig
import jsonrpcclient
from solders.pubkey import Pubkey


class UserStatsMap:
Expand Down Expand Up @@ -108,7 +105,7 @@ async def sync(self):
Pubkey.from_string(pubkey), DataAndSlot(slot, data)
)
else:
self.update_user_stat(pubkey, DataAndSlot(slot, data))
await self.update_user_stat(pubkey, DataAndSlot(slot, data))

await asyncio.sleep(0)

Expand Down

0 comments on commit c81bcac

Please sign in to comment.