multithreading – What is the best architecture for a bot running a background service

I built a Telegram bot that allowed users to run a configurable script on my server.
Here is how it works:

  1. User contacts the bot
  2. User configures how he wants to run the script.
  3. User asks the bot to start it.

What happens when the user starts it is that I create a new thread running the script.

# (user configures)
# (user asks the bot to start the script)
# I do this:
thread = threading.Thread(target=myscript.always_running_function, args=(user_id))
# continue listening to config changes/other users

The script involves listening from updates from another API so I thought running it as a thread would be a good choice.

Now what happens is that some users tell me that the script stops working after a while. Perhaps the thread gets killed by the OS after a while?

I am trying to understand what is a good architecture for such an application.

Right now, there are 10 people who use the bot so it handles it effectively. What if there is a huge load later? Should I run it on EC2 instances with load balancing enabled?

Another way I was thinking of making it work is like this:

  1. Running the bot on a separate EC 2 instance
  2. Running a web server on another instance with load balancing.
  3. Now when a user asks the bot to run it, the bot calls the web server and runs a new process/thread there.

I wonder what would be the implications when load balancing comes into the picture.

Another question: thread vs new process. Different processes did not work properly the last time I tested so I want to know whether it is my mistake or running a different process IS a wrong way of doing it.

germany – On German bicycle direction signs, what does the background colour for bicycle highway pictograms indicate?

On this direction sign at Wixhausen near Darmstadt, Germany, several destination use a bicycle highway pictogram. Some of the pictograms have a black background, whereas others have a green background. What is the difference in meaning between the pictograms with a black background vs. the pictograms with a green background?

Bike freeway sign

This sign indicates Darmstadt and Arheiligen with a black-background pictogram, Egelsbach and Erzhausen with a green-background pictogram, and Frankfurt and Langen with both.

From context, it might mean green means finished and black means not finished, but I think that’s not consistent with signs I’ve seen elsewhere, and I would find it an unusual meaning for traffic signs, so it’d be interesting to have a confirmation.

I did not find an explanation at this list of traffic signs for cyclists. At this stv2go list bicycle highways aren’t mentioned at all.

2d – Unity Pixel Perfect Camera Component. Cropping Frame, Stretch Fill, Using a Background behind the Camera?

So I was reading through this recent post: Help me Make Sense of Unity 2D Resolution Management

And it reminded me when I attempted to use Unity in this way. I wanted to be in control of every pixel but I found it too tricky and ended up working on some cool 3d animations etc.

I read and mostly understood the answer in the thread, and decided to have another go myself.

I’m making Tetris style game, 10×20 ‘cells’ play area in the visible camera. Using the advice in the post…

I set my sprite PPU to match the size of my Tetris block (ie. 32).
The ‘Reference Resolution’ to 320×640
I ended up ticking ‘Crop Frame X Y’ and ‘Stretch Fill’ -(because I would like this ‘window’ to be exactly the size of the play area, I want to have another camera overlay (or behind) which will show the score etc or potentially a second players play area)

The problem I now have is that I cannot change the ‘Viewport Rect’ etc from the Camera component. Lets say I don’t want the play area in the centre, perhaps I want it on the left of the screen. Well I can change the viewport rect, but once the game begins the Pixel Perfect Camera takes control of that and changes the settings. Likewise, if I don’t have ticked Crop Frame/Stretch Fill, then I cannot change the ‘Size’ in the Camera (so in that case it jumps back to something like 16 (it should be exactly 10). And leaves the play area as a small zoomed out area in the dead centre of the screen).

Taking screenshots to demonstrate the problem proved harder than i thought. Basically screen #1 is showing that I changed ‘Size’ to 10. And in screen #2 it shows it defaults back to 16.875. Screen #3 shows the play area (in the ‘Game’ preview window) correctly. But I have no control over its layout and position on the screen.

Thanks for any help.

enter image description here

enter image description here

enter image description here

I will do any Photo Background Remove& PhotoshopEditing for $2

I will do any Photo Background Remove& PhotoshopEditing

­I will do any Photo Background Remove and PhoshopEditing

Hello Dear Sir/Mam,

My Name is Nayem , I am a Professional Graphic Designer. I know that you are looking for High Quality Photoshop Editing Services for your image like Remove Background /Change!! Don”t Worry you’ve come to the right Gig.I am expart in any photo background removal, Clipping path. Change background,Resizing& photoshopediting.I will your Job Professionally. I will Provide You Unlimited Revisions And Concept Your Offer And Until You Get Dream Work. I will Work Until You Satisfy 100%.If You Have Any Question Please Ask Me. I Will Respond You AS Soon Possible. You Can Contact Me For Free Trial for First Sample.

My Services

· Background Removal

· Clipping Path for any image

· Any Object Remove

· Change Background (whatever you Need)

· Photoshop Editing

My portfolio link:

File Format:

I hope you are satisfied with what I have done.
My Peace of mind in my Customer Satisfaction

Thank you
Nayem uddin


applications – Disable autostart on boot and restrict background execution

Without getting into the details whether or not one should stop autostarting apps, and what could be the consequences as discussed in a plenty of other answers, here are my simple solutions which may work without any third party apps, at least on Android Pie.


Apps use BroadcastRceivers to listen for broadcast ACTION_BOOT_COMPLETED so that they can run on boot. Broadcast receiver is an app component that can be disabled with root privileges.

Using Package Manager list all broadcast receivers listening for BOOT_COMPLETED:

~# pm query-receivers --components -a android.intent.action.BOOT_COMPLETED

It will give a list of broadcast receivers in format package_name/component_name. See dumpsys activity broadcast-stats and dumpsys activity broadcasts for more details.

Now to disable a component:

~# pm disable <package/component>

There are apps like Autostarts ( and SD Maid (eu.thedarken.sdm) which can do same for you. File /data/system/users/0/package-restrictions.xml can also be edited directly to disable apps or their components, but it’s not recommended.
It’s possible to disable multiple broadcast receivers of an app, and a single receiver can also possibly listen to multiple types of broadcast events.

NON-ROOT SOLUTION: (non-universal)

In order to receive android.intent.action.BOOT_COMPLETED, apps need android.permission.RECEIVE_BOOT_COMPLETED which is a normal permission and hence can’t be revoked by user.

However there is a hidden permission management framework, named AppOps that provides a slightly more fine-grained control of (permission-like) operations. OP_BOOT_COMPLETED is one of those but it’s not a part of AOSP, only added by some custom ROMs like LineageOS. If you are on one of such ROMs, you can control the autostart behavior through adb shell:

~$ appops set <package> BOOT_COMPLETED deny

Now the app won’t be allowed to receive BOOT_COMPLETED broadcast. There are apps like App Ops (rikka.appops) which can do same for you. Some custom ROMs have built-in front-ends to AppOps with different names like Privacy Guard, AutoStart Manager etc.

Please note that AppOps:

is not generally intended for third party application developers; most features are only available to system applications

So its usage without root may be disallowed or get harder in next Android releases.

Both of the above methods can stop apps from starting on boot only. An app can listen for some other broadcast events too and it can keep on restarting if killed, or run in background continuously (as a service) if it’s designed to be so. See dumpsys activity services for more details.

A slightly different approach would be to stop apps from running in background by using OP_RUN_IN_BACKGROUND (introduced in Nougat) and/or RUN_ANY_IN_BACKGROUND (introduced in Pie) which are part of AOSP:

~$ appops set <package> RUN_IN_BACKGROUND deny

They don’t have an equivalent manifest permission, but there is an experimental permission with same name.

i will create Adobe photoshop editing and image retouching any manipulation for $3

i will create Adobe photoshop editing and image retouching any manipulation

Welcome to Land my page and Service . I have More than 6 YEARS of Photoshop experience, Great communication and customer satisfaction.I am

here to work on your photo to make it just complete as per the


I am excited to offer you my services and Adobe Photoshop your images to make them out-of-this-world Beautiful and

Graceful.The Best Quick & Fastest Photoshop Editing Service Ever.

A Professional Photoshop Editor at your service.

  • Image Background Removal/ Transparent
  • Brochures Wedding Photography Touch Ups

Why Hire Me For This Services?

  1. 24 Hours Service
  2. Fast and friendly customer service
  3. 06+ years of experience in Photoshop
  4. 100% refund if not satisfied
  5. Any Photoshop Editing, or Graphic designing Retouching, Manipulation gig will handle professionally Redesign
  6. Unlimited Revisions on all gigs

Please Contact me Before and place an Order or Tex Message me


dnd 5e – Do I, as a druid, add the spells from the Gruul Anarch background to my list of spells that I can prepare anytime?

Guild spells are added to your class’s spell list.

The rules for Gruul Guild Spells state:

For you, the spells on the Gruul Guild Spells table are added to the spell list of your spellcasting class.

And the druid’s spell preparation rules state:

You prepare the list of druid spells that are available for you to cast, choosing from the druid spell list.

Since as a druid your guild spells are added to the druid spell list, you can prepare them as a druid.

bluetooth – Background ble scan in one plus

We are trying to build an app which scan nearby Bluetooth devices and shows on the UI, we also have event listener which detects whenever location or bluetooth state is changed and accordingly we start the Bluetooth scan, we also make sure no more then 5 bleScan happens within 30 seconds.

Now heres the problem,
This app works fine for phones like Nokia, Asus etc, but for one plus what we have noticed is, whenever we are in background, and we disabled and enabled bluetooth, it dosent start the scan(in the code it reaching but no errors are been thrown) nor it throws error in onScanFailed callback, we didnt see this behavior in other phone

so it dosnet work if the setting is the following

enter image description here

but if we make the location “Allow all the time” , then it works perfectly

enter image description here

My question is who is doing it properly one plus or other phones? Am i missing some additional settings for one plus. please help