@@ -46,25 +46,32 @@ public JobManagerService(IServiceScopeFactory scopeFactory, JobFactoryService jo
4646 continue ;
4747 }
4848
49- // Convert old namespaces to support old databases
50- if ( entity . JobOptions . Contains ( "OpenBullet2.Models" ) || entity . JobOptions . Contains ( ", OpenBullet2\" " ) )
49+ try
5150 {
52- entity . JobOptions = entity . JobOptions
53- . Replace ( "OpenBullet2.Models" , "OpenBullet2.Core.Models" )
54- . Replace ( ", OpenBullet2\" " , ", OpenBullet2.Core\" " ) ;
51+ // Convert old namespaces to support old databases
52+ if ( entity . JobOptions . Contains ( "OpenBullet2.Models" ) || entity . JobOptions . Contains ( ", OpenBullet2\" " ) )
53+ {
54+ entity . JobOptions = entity . JobOptions
55+ . Replace ( "OpenBullet2.Models" , "OpenBullet2.Core.Models" )
56+ . Replace ( ", OpenBullet2\" " , ", OpenBullet2.Core\" " ) ;
5557
56- jobRepo . UpdateAsync ( entity ) . Wait ( ) ;
57- }
58+ jobRepo . UpdateAsync ( entity ) . Wait ( ) ;
59+ }
60+
61+ var wrapper = JsonConvert . DeserializeObject < JobOptionsWrapper > ( entity . JobOptions , jsonSettings ) ;
62+ if ( wrapper ? . Options is null )
63+ {
64+ continue ;
65+ }
5866
59- var wrapper = JsonConvert . DeserializeObject < JobOptionsWrapper > ( entity . JobOptions , jsonSettings ) ;
60- if ( wrapper ? . Options is null )
67+ var options = wrapper . Options ;
68+ var job = jobFactory . FromOptions ( entity . Id , entity . Owner == null ? 0 : entity . Owner . Id , options ) ;
69+ AddJob ( job ) ;
70+ }
71+ catch ( Exception ex )
6172 {
62- continue ;
73+ Console . WriteLine ( $ "Skipped restoring job { entity . Id } : { ex . Message } " ) ;
6374 }
64-
65- var options = wrapper . Options ;
66- var job = jobFactory . FromOptions ( entity . Id , entity . Owner == null ? 0 : entity . Owner . Id , options ) ;
67- AddJob ( job ) ;
6875 }
6976
7077 _scopeFactory = scopeFactory ;
0 commit comments