NotificationHubJob is stuck on status "Started"

55 Views Asked by At

I've had this code working that exports our notification subscribers into a blob container:

var createTask = client.SubmitNotificationHubJobAsync(new NotificationHubJob
{
    JobType = NotificationHubJobType.ExportRegistrations,
    OutputContainerUri = outputContainerSasUri
});

var timedOut = false;
var startTime = DateTime.Now;
var exportJob = await createTask;

Console.WriteLine("Exporting registrations to {0}", exportJob.JobId);

var existingJobs = await client.GetNotificationHubJobsAsync();

while (exportJob.Status != NotificationHubJobStatus.Completed && !timedOut)
{
    timedOut = DateTime.Now - startTime > TimeSpan.FromSeconds(exportTimeoutSeconds);
    await Task.Delay(TimeSpan.FromSeconds(10));
    exportJob = await client.GetNotificationHubJobAsync(exportJob.JobId);
}

if (timedOut)
{
    Console.WriteLine("Export timed out after {0} seconds", exportTimeoutSeconds);
    return null;
}
else
{
    Console.WriteLine($"EXPORTED {exportJob.OutputFileName}");
    return exportJob.OutputFileName;
}

Now something has stopped working. The status of the exportJob I just created never changes from "Started" and when looking at the existingJobs I can only see one failed job several months old, no other jobs.

It is creating the files Output.txt and test.json in the blob container but they are empty.

I'm at loss for how to debug this since I get no errors and since this has been working previously.

0

There are 0 best solutions below