django / asgi_ipc

IPC-based ASGI channel layer
BSD 3-Clause "New" or "Revised" License
37 stars 13 forks source link

[WIP] Store data in sqlite #22

Closed rixx closed 7 years ago

rixx commented 7 years ago
andrewgodwin commented 7 years ago
rixx commented 7 years ago
rixx commented 7 years ago

The prefix is back to being included in db names and semaphore.

The only remaining issue was a string/unicode compatibility issue - I solved it by checking version_info and using decode where appropriate in one place, but if you'd prefer, I could also go look for the appropriate six method …

andrewgodwin commented 7 years ago

Yeah, the pattern I've used elsewhere is if isinstance(value, six.binary_type): for that sort of check, so it would be great if you could switch that over.

Otherwise, I'm very happy with this, and if you think it's ready to merge over I'm happy to do so. If you have spare time and a love for nasty testing environments, you could try benchmarking both the old and new versions, but I can do that later on - and besides, the code simplification alone here makes me much happier.

rixx commented 7 years ago

If you have spare time and a love for nasty testing environments

Neither, really, but for the sake of a clean conscience I'd like to test this for a bit next week. I'll ping you when I'm done.

andrewgodwin commented 7 years ago

Haha, alright. I'll try to give it a test drive too.

andrewgodwin commented 7 years ago

@rixx did you get a chance to play around with this? I'm going to sit down tomorrow, check, and merge it, just wanted to see if you had.

rixx commented 7 years ago

Nope, I haven't, sorry, been terribly busy. Rebased against master just now.

andrewgodwin commented 7 years ago

Just tested it out, looks like there's some thread safety issues, but I'll merge it in and address those in the master branch!

rixx commented 7 years ago

Ooookay, hopefully it's not too bad. 🙈

andrewgodwin commented 7 years ago

Nah, nothing worse than what I had to deal with before with shared memory and threading. I'm pushing the commits up to the master branch now as I fix it - almost there!

thijsvandien commented 7 years ago

Will semaphores be needed still, since SQLite can operate in serialized mode (effectively using semaphores itself then)? I too find it odd to move the IPC project to use a database. I think enough improvements can be made to make actual IPC work sufficiently well, and then asgi_sqlite would be a welcome alternative. If we turn asgi_ipc into asgi_sqlite without changing the name, eventually some asgi_real_ipc will come along.

andrewgodwin commented 7 years ago

@thijsvandien I've since moved back from this to a different approach to shared memory as SQLite's locking was failing badly on some platforms, so I guess what you asked for happened already.