Can't set realtime thread priority=99: Operation not permitted. When using the c# wrapper

I’m using the C# wrapper with a web api in .net 7. The first image I want to show on my pixel display with the wrapper works. But every image after that gives the following error

Can't set realtime thread priority=99: Operation not permitted.
        You are probably not running as root ?
        This will seriously mess with color stability and flicker
        of the matrix. Please run as `root` (e.g. by invoking this
        program with `sudo`), or setting the capability on this
        binary by calling
        sudo setcap 'cap_sys_nice=eip' /home/sharevalue/pixelsharp/bin/Debug/net7.0/pixelsharp

Now, I have to run the app with sudo dotnet run, otherwise it wont work.
Does anyone know what to do to fix my issue?

did you do what the message said?
sudo setcap ‘cap_sys_nice=eip’ /home/sharevalue/pixelsharp/bin/Debug/net7.0/pixelsharp

Yes but the problem is that you have to set that with every request. But I fixed it now by using a Singleton pattern :slight_smile: