Jump to content

Scheduled Task IsHidden flag not working?


Go to solution Solved by Luke,

Recommended Posts

RoastedChicken
Posted

Hello, I'm working on a plugin and was creating a scheduled task to do a health check, however I dont want this task to be shown in the scheduled task.

Here's an example of my scheduled task code:

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Tasks;

namespace Emby.Example.Tasks
{
    public class TestConnectionTask : IScheduledTask
    {
        private readonly ILogger _logger;

        public TestConnectionTask(ILogManager logManager)
        {
            _logger = logManager.GetLogger(GetType().Name);
        }

        public string Name => "Test Connection";
        
        public string Key => "Test Connection";
        
        public string Description => "Tests the connection";
        
        public string Category => "Example App";
        
        public bool IsHidden => true;
        
        public bool IsEnabled => true;
        
        public bool IsLogged => true;

        public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
        {
            try
            {
               
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error during test", ex);
                throw;
            }
        }

        public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
        {
            return new TaskTriggerInfo[] { };
        }
    }
}

I can still see the task in the scheduled task page.

  • Solution
Posted

Hi, try also having it implement IConfigurableScheduledTask.

RoastedChicken
Posted

That did it, thank you Luke!

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...