في صفحة تطبيق الويب تحدثنا عن تصميم تطبيق الويب.
لكن هناك تحد أساسي غير محصور بتطبيق الويب لكن تطبيق الويب هو الذي ركز النظر عليه وهو مسألة Concurrency
ظهرت المشكلة لاول مرة عند استعمال خادم paste في تطبيق الويب
File "Thawab/core.py", line 382, in getSliceBoundary r=self.__c.execute(SQL_GET_GLOBAL_ORDER,(nodeIdNum,)).fetchone() ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1245709456 and this is thread id -1258292368
تقول sqlite FAQ ويقول هذا الرابط أن الإصدارات الحديثة من sqlite تسمح فتح الاتصال في thread واستعماله في واحد آخر لكن ليس ال cursor
The restriction on moving database connections across threads was relaxed somewhat in version 3.3.1. With that and subsequent versions, it is safe to move a connection handle across threads as long as the connection is not holding any fcntl() locks. You can safely assume that no locks are being held if no transaction is pending and all statements have been finalized.
FWIW: Later versions of sqlite claim you can share connections and objects across threads (except **cursors**), but I've found otherwise in actual practice.
لكن يبدو أن كلمة statements تشمل عمليات قراءة فقط أو ما شابه.
حيث أنه عندما تم الاستغناء عن كل ال cursors وتم طلب cursor جديد من ال connection حصلنا على
File "/opt/proj/thawab/Thawab/core.py", line 415, in getSliceBoundary r=self.cn.execute(SQL_GET_GLOBAL_ORDER,(nodeIdNum,)).fetchone() ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1221371024 and this is thread id -1289761936
واحد أو أكثر مما يلي
ليس ضمن اهتمامنا الآن
لكن تم نقل كل عمليات التحرير وهما Kitab.appendToCurrent و Kitab.dropDecendants لتكون طريقة ل KitabCursor وعملية إنشاء ال Cursor تعمل lock مع أنه الآن مجرد pass.