Skip to content

Commit

Permalink
Merge pull request #16 from tblanarik/revert-15-tblanarik/table-cleanup
Browse files Browse the repository at this point in the history
Revert "Error handling and stubbing out table cleanup methods"
  • Loading branch information
tblanarik authored Sep 28, 2024
2 parents c04ab4d + 7447ced commit 2055470
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
4 changes: 0 additions & 4 deletions cleanup.py

This file was deleted.

22 changes: 2 additions & 20 deletions function_app.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
import logging
import azure.functions as func
import spotbot as sb
import cleanup

app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)

@app.route(route="spotbot", methods=[func.HttpMethod.POST])
def spotbot(req: func.HttpRequest) -> func.HttpResponse:
try:
sb.run(req)
except Exception as _excpt:
logging.error(f"Exception occurred: {_excpt}")
return func.HttpResponse(body=f"Exception occurred: {_excpt}", status_code=500)
else:
return func.HttpResponse(status_code=202)

@app.function_name(name="tablecleanup")
@app.schedule(schedule="0 8 * * *",
arg_name="tablecleanup",
run_on_startup=False)
def table_cleanup(timer: func.TimerRequest) -> None:
cleanup.cleanup()

@app.route(route="manualcleanup", methods=[func.HttpMethod.POST])
def manual_cleanup(req: func.HttpRequest) -> func.HttpResponse:
cleanup.cleanup()
sb.run(req)
return func.HttpResponse(status_code=202)

0 comments on commit 2055470

Please sign in to comment.