kazcw/miro — comment on commit 62deae1ad9d54a91ff78bc39d3d1c096a18d437c
File: tv/lib/metadata.py line 387
By bendk:

This loop is happening outside the backend thread right? In that case we shouldn't be touching the DB and probably shouldn't be touching the attributes inside MetadataManager.

I think we should use an approach like this:

1) Make _thread_loop() a module-level function and don't have it access anything outside of it's local scope, except things that are specifically thread-safe.
2) Make _thread_loop() input a Queue object that it gets data from. We only push filenames to the Queue, rather than the entire Item object.
3) process_item() gets refactored to work without touching the DB
a) change process_item() to input filename and item_id (maybe more, but definitely not a DDBObject).
b) instead of creating ItemMetadata objects itself, it sends data to function that runs in the backend thread using eventloop.add_idle(). That function does the actual DDBObject creation.