feat: fix
This commit is contained in:
2
main.py
2
main.py
@@ -10,6 +10,7 @@ from starlette.staticfiles import StaticFiles
|
|||||||
import routers
|
import routers
|
||||||
from constants import API_ROOT
|
from constants import API_ROOT
|
||||||
from external.kafka import producer, consume_messages
|
from external.kafka import producer, consume_messages
|
||||||
|
from external.kafka.producer import init_producer
|
||||||
|
|
||||||
origins = [
|
origins = [
|
||||||
'http://localhost:5173'
|
'http://localhost:5173'
|
||||||
@@ -19,6 +20,7 @@ origins = [
|
|||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def lifespan(app: FastAPI):
|
async def lifespan(app: FastAPI):
|
||||||
try:
|
try:
|
||||||
|
await init_producer()
|
||||||
await producer.start()
|
await producer.start()
|
||||||
except KafkaConnectionError as e:
|
except KafkaConnectionError as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user