-
-
Save martinferreira/f82d8a79485854ec72a90608ebc38e0f to your computer and use it in GitHub Desktop.
17790 : AC: Prototype automation of one off jobs for trident deploys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
DECLARE @InvocationData VARCHAR(500) | |
SET @InvocationData = '{"Type":"Lightstone.Trident.Api.Jobs.ElasticSearchRebuildIndexes, Lightstone.Trident.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","Method":"RebuildIndexes","ParameterTypes":"[]","Arguments":"[]"}' | |
INSERT into [HangFire].[Job] (StateId, StateName, InvocationData, Arguments, CreatedAt, ExpireAt) values (NULL, 'Enqueued', @InvocationData,'[]', GETUTCDATE(), NULL) | |
DECLARE @JobId int | |
select @JobId=id from [HangFire].[Job] where statename = 'Enqueued' and invocationdata = @InvocationData and StateId is null | |
INSERT into [HangFire].[State] ( JobId, Name, Reason, CreatedAt, Data) values | |
( @JobId, 'Enqueued', NULL, GETUTCDATE(), '{"EnqueuedAt":"' + (CONVERT(VARCHAR,GETUTCDATE(), 120))+'","Queue":"default"}') | |
DECLARE @StateId int | |
SELECT @StateId = id from [HangFire].[State] Where JobId = @JobId | |
UPDATE [HangFire].[Job] SET StateId = @StateId where Id = @JobId | |
INSERT INTO [HangFire].[JobQueue] (JobId, Queue) VALUES (@JobId, 'default') | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment