(f, fs, channel, access)
| 2 | |
| 3 | |
| 4 | def upload(f, fs, channel, access): |
| 5 | try: |
| 6 | fid = fs.put(f) |
| 7 | except Exception as err: |
| 8 | print(err) |
| 9 | return "internal server error, fs level", 500 |
| 10 | |
| 11 | message = { |
| 12 | "video_fid": str(fid), |
| 13 | "mp3_fid": None, |
| 14 | "username": access["username"], |
| 15 | } |
| 16 | |
| 17 | try: |
| 18 | channel.basic_publish( |
| 19 | exchange="", |
| 20 | routing_key="video", |
| 21 | body=json.dumps(message), |
| 22 | properties=pika.BasicProperties( |
| 23 | delivery_mode=pika.spec.PERSISTENT_DELIVERY_MODE |
| 24 | ), |
| 25 | ) |
| 26 | except Exception as err: |
| 27 | print(err) |
| 28 | fs.delete(fid) |
| 29 | return f"internal server error rabbitmq issue, {err}", 500 |
nothing calls this directly
no outgoing calls
no test coverage detected