async void OnJobOutputMessage(string clientId, JobOutputMsg msg)
        {
            var db = await this.redis.GetDatabase();

            // var values = new List<NameValueEntry>();

            if (msg.Stream != null)
            {
                await db.StringAppendAsync(
                    FormatJobStdout(msg.JobId),
                    msg.Stream,
                    flags : CommandFlags.FireAndForget);
            }

            if (msg.Error != null)
            {
                await db.StringAppendAsync(
                    FormatJobError(msg.JobId),
                    msg.Error,
                    flags : CommandFlags.FireAndForget);
            }

            // if (msg.Stream != null)
            //     values.Add(new NameValueEntry("stream", msg.Stream));
            // if (msg.Error != null)
            //     values.Add(new NameValueEntry("error", msg.Error));

            // await db.StreamAddAsync(
            //     FormatJobStdout(msg.JobId),
            //     values.ToArray(),
            //     maxLength: 2000,
            //     flags: StackExchange.Redis.CommandFlags.FireAndForget);
        }
        async void OnJobOutputMessage(string clientId, JobOutputMsg msg)
        {
            var db = await this.redis.GetDatabase();

            // Autoclean output logs after a specific timeout.
            TimeSpan timeout = TimeSpan.FromMinutes(30);

            if (msg.Stream != null)
            {
                string key = FormatJobStdout(msg.JobId);
                await db.StringAppendAsync(
                    key,
                    msg.Stream,
                    flags : CommandFlags.FireAndForget);

                await db.KeyExpireAsync(key, timeout);
            }

            if (msg.Error != null)
            {
                string key = FormatJobError(msg.JobId);
                await db.StringAppendAsync(
                    key,
                    msg.Error,
                    flags : CommandFlags.FireAndForget);

                await db.KeyExpireAsync(key, timeout);
            }

            // if (msg.Stream != null)
            //     values.Add(new NameValueEntry("stream", msg.Stream));
            // if (msg.Error != null)
            //     values.Add(new NameValueEntry("error", msg.Error));

            // await db.StreamAddAsync(
            //     FormatJobStdout(msg.JobId),
            //     values.ToArray(),
            //     maxLength: 2000,
            //     flags: StackExchange.Redis.CommandFlags.FireAndForget);
        }