Ayinope Dev Blog: 2017–10–25
This post will be the first in series of development blog posts regarding whatever I’m currently working on. Hopefully this will keep me somewhat more on track as I try to figure out where I want to focus my energy. Feedback and formatting suggestions are always welcome!
I have a few projects going on right now, but most of my effort is focused either on schoolwork or on preparing for Yeezy season. I’m currently trying to modernize my Shopify setup by removing redundancies and simplifying things overall. A lot of my Shopify code was being reused all over the place and it didn’t make any sense to do so. Without going into too much detail right away, I’m basically just centralizing my monitor so I can do a bunch of things with it and not have to run a million instances of it.
Shopify Monitor/WebSocket Stream
My current primary focus has been to modernize my Shopify monitor. Old versions of my Shopify slackbot basically ran code to monitor the sitemaps for a bunch of different Shopify sites. This is effective but limited to just Slack and not really useful for much else. I eventually started expanding to Twitter and even running bots from slack, but I was limited by my overall architecture. It doesn’t make sense to have the Shopify monitor also do heavy lifting like posting to Slack/Twitter or running bots. This is especially true when trying to run dozens of checkout threads on a low-memory server.
My solution to this problem has been to separate the monitor from everything else. Instead of handling Slack/Twitter or anything else, my Shopify monitor only looks for new products and broadcasts to clients via a WebSocket server. I now have Slack/Twitter clients that connect to the WebSocket stream via my open-source Shopify Stream SDK. The SDK handles basic necessities like the option to specify domains and keywords. Clients receive new products in the form of a JSON object and can do with it what they please.
This solution allows me to move my Slack/Twitter connectors elsewhere and make them much lighter. This also means that I only have to have one server and only need to maintain one list of proxies. Overall, I’m pretty happy with it for now. I need to make it more robust and smooth out some kinks, but it’s getting there. Some minor updates to the Stream SDK should be coming soon to match my updates to the monitor.
My secondary project has been to develop a Shopify wrapper utilizing my AIO Framework. I keep re-developing this core library and it really doesn’t make sense for each Shopify related bot to implement small pieces of it. This is basically a centralization effort so I can just import the Shopify wrapper in all of my scripts. I’m debating open-sourcing this but we’ll see what happens. I’ll likely end up spinning up my own private package index if I don’t want to publish some of my packages on PyPI.
That’s it for today. Hopefully I keep this up and can continue to get things moving! Check out my GitHub for more cool projects or just follow me here!