refactor valkey into objects with health check
This commit is contained in:
@@ -2,9 +2,18 @@ import logging
|
||||
from dotenv import load_dotenv
|
||||
import requests
|
||||
import os
|
||||
import json
|
||||
from decimal import Decimal
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
class JSONEncoder_Decimal(json.JSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, Decimal):
|
||||
return float(o)
|
||||
return super(JSONEncoder_Decimal, self).default(o)
|
||||
|
||||
def upsert_list_of_dicts_by_id(list_of_dicts, new_dict, id='id', seq_check_field: str | None = None, reset_seq_id: bool = False) -> list[dict]:
|
||||
for index, item in enumerate(list_of_dicts):
|
||||
if item.get(id) == new_dict.get(id):
|
||||
|
||||
Reference in New Issue
Block a user