feat: ozon sync
This commit is contained in:
60
test.py
60
test.py
@@ -1,18 +1,54 @@
|
||||
import asyncio
|
||||
import datetime
|
||||
# import asyncio
|
||||
#
|
||||
# from dict_hash import dict_hash
|
||||
# from sqlalchemy.ext.asyncio import AsyncSession
|
||||
#
|
||||
# from backend.session import session_maker
|
||||
# from marketplaces import MarketplaceControllerFactory
|
||||
# from models import Marketplace
|
||||
# import pickle
|
||||
# pickle.dumps()
|
||||
#
|
||||
# async def main():
|
||||
# a = "example"
|
||||
# b = "example"
|
||||
#
|
||||
# print(hash(a)) # Хэш для строки "example"
|
||||
# print(hash(b)) # Хэш для строки "example", будет таким же как и у a
|
||||
#
|
||||
# return
|
||||
# session: AsyncSession = session_maker()
|
||||
#
|
||||
# try:
|
||||
# mp = await session.get(Marketplace, 2)
|
||||
# if not mp:
|
||||
# return
|
||||
# c = MarketplaceControllerFactory.get_controller(session, mp)
|
||||
# await c.synchronize_products()
|
||||
# finally:
|
||||
# await session.close()
|
||||
#
|
||||
#
|
||||
# if __name__ == '__main__':
|
||||
# loop = asyncio.get_event_loop()
|
||||
# loop.run_until_complete(main())
|
||||
import hashlib
|
||||
import time
|
||||
|
||||
from sqlalchemy import select, func
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import joinedload
|
||||
from reportlab.rl_settings import autoGenerateMissingTTFName
|
||||
|
||||
import models
|
||||
from backend.session import session_maker
|
||||
from models import User, PaymentRecord
|
||||
from decorators.locking import lock, redis_client
|
||||
|
||||
|
||||
async def main():
|
||||
pass
|
||||
@lock('synchronize_marketplace', include_args_in_key=True)
|
||||
def test(marketplace_id: int):
|
||||
print("test")
|
||||
time.sleep(100)
|
||||
|
||||
|
||||
def main():
|
||||
test(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user