---Presenter: Eric WeathersSubject: How to Set Up a Hash to Cache or Prevent Making Unnecessary CallsDuration: 00:12:08---00:00:06.930 --> 00:00:11.767 - OK, so let's look at I Commerce. 00:00:18.040 --> 00:00:21.307 - Here, let me turn down frozen for my son in the 00:00:21.307 --> 00:00:21.901 - background here. 00:00:27.070 --> 00:00:32.390 - OK, I see we want clarity connects. 00:00:33.490 --> 00:00:35.884 - And then in the app settings here in solution. 00:00:37.420 --> 00:00:40.316 - Oh, it's not going solutions. OK, that's right. 00:00:40.316 --> 00:00:44.660 - I may need to go look at. I think it's in core. 00:00:47.830 --> 00:00:48.890 - No, it's not there. 00:00:51.700 --> 00:00:52.480 - Connecting 00:00:54.400 --> 00:00:55.390 - not there. 00:01:00.150 --> 00:01:05.389 - Yeah, here we go. So in the hang fire task initializer, which is 00:01:05.389 --> 00:01:09.016 - in the 05 clarity connect server. Hang fire test 00:01:09.016 --> 00:01:12.240 - initializer. This is where we're actually initializing the 00:01:12.240 --> 00:01:15.464 - background job server options and actually initializing hang 00:01:15.464 --> 00:01:18.110 - fire so. Let me make sure yeah 00:01:18.110 --> 00:01:20.540 - so. Right here on work account. 00:01:21.930 --> 00:01:25.614 - The it's gonna it's gonna read from the app settings, this app 00:01:25.614 --> 00:01:28.991 - setting and basically you need to set the app setting to 00:01:28.991 --> 00:01:31.754 - whatever number of worker count what. Basically work account 00:01:31.754 --> 00:01:34.824 - does. It allows you to utilize multiple workers that are 00:01:34.824 --> 00:01:38.201 - designated for connect so you can run multiple jobs at the 00:01:38.201 --> 00:01:42.192 - same time in older version of hang fire which is what this is, 00:01:42.192 --> 00:01:45.876 - which is what this utilizes. It defaults to one, which is why 00:01:45.876 --> 00:01:47.718 - we're also defaulting to 1 here. 00:01:49.340 --> 00:01:52.556 - However, that doesn't. You know that allows for. If I have five 00:01:52.556 --> 00:01:55.504 - jobs that Q Every you know every five minutes, they'll run 00:01:55.504 --> 00:01:59.256 - through one at a time, so you won't get as you know, it might. 00:01:59.256 --> 00:02:01.668 - Performance might increase, but you know you're not handling 00:02:01.668 --> 00:02:04.884 - multiple Ann where we're seeing where we saw an issue with EA 00:02:04.884 --> 00:02:08.100 - was that we didn't have this set and they're running jobs every 00:02:08.100 --> 00:02:12.120 - minute. Well, they have a lot of data coming in, so if Iran, if I 00:02:12.120 --> 00:02:14.532 - started running accounts, then accounts and start running, and 00:02:14.532 --> 00:02:18.016 - let's say it takes 30 seconds and I have 4 tour total jobs, 00:02:18.016 --> 00:02:21.500 - and then sales orders runs and it takes 30 seconds, well now my 00:02:21.500 --> 00:02:24.180 - minute is up and they're going to start queuing again. 00:02:24.760 --> 00:02:28.751 - And I'm still having to run the older jobs, so what's what was 00:02:28.751 --> 00:02:31.207 - happening was basically there weren't enough worker count 00:02:31.207 --> 00:02:34.584 - worker processes to run all of the jobs simultaneously, so we 00:02:34.584 --> 00:02:38.268 - just bumped this worker count up now for the new, and that's 00:02:38.268 --> 00:02:42.259 - literally it. That's all we have to do here is in this background 00:02:42.259 --> 00:02:45.329 - job server options set this worker count to be whatever 00:02:45.329 --> 00:02:49.013 - we're going to in the app settings for the new connect. We 00:02:49.013 --> 00:02:52.697 - do not have to do that and I'll bring it up just. 00:02:53.630 --> 00:02:55.398 - Just to show but. 00:02:56.400 --> 00:02:58.997 - In in newer versions of hang fire. 00:03:01.570 --> 00:03:04.918 - Country three and newer versions of hang fire, the. 00:03:06.730 --> 00:03:10.822 - The default worker count is the total number of processors times 00:03:10.822 --> 00:03:14.914 - 5, so if you're running on a quad core processor, you're 00:03:14.914 --> 00:03:19.378 - going to have a total worker count of 20 where you can 00:03:19.378 --> 00:03:21.238 - override that and let me. 00:03:22.150 --> 00:03:25.032 - Double check that for sure is here in the start up. 00:03:25.700 --> 00:03:26.560 - Uh. 00:03:28.770 --> 00:03:32.375 - Sorry, and service extensions hang fire extensions. 00:03:34.470 --> 00:03:40.014 - You can set I believe here in the ad hang fire you can do. 00:03:42.000 --> 00:03:45.807 - Background job processor options. I think it's there. Let 00:03:45.807 --> 00:03:48.768 - me go take a look in services. 00:03:49.670 --> 00:03:50.820 - Job service. 00:03:56.400 --> 00:03:59.898 - So it might be here in this recurring job options there 00:03:59.898 --> 00:04:03.396 - there will be like a worker processes property on here and 00:04:03.396 --> 00:04:07.212 - at that point you can set it so then similarly using using 00:04:07.212 --> 00:04:10.074 - dependency injection for how we'd normally do our other 00:04:10.074 --> 00:04:13.572 - options basis. So like for example, we have. You know we 00:04:13.572 --> 00:04:17.706 - can add in a section for Cron settings in this. In one of 00:04:17.706 --> 00:04:21.204 - these, or we can create an entirely new options class. We 00:04:21.204 --> 00:04:25.020 - can inject those values into our app settings here as well, so 00:04:25.020 --> 00:04:26.928 - just a way that we can. 00:04:28.230 --> 00:04:30.777 - Inject that in so it's manageable at the appsettings 00:04:30.777 --> 00:04:34.173 - level rather than hard coding it in but that is where you 00:04:34.173 --> 00:04:37.286 - would override it is here in the job service you would 00:04:37.286 --> 00:04:40.116 - inject that options in this Cron settings or wherever you 00:04:40.116 --> 00:04:43.512 - want to put it and then set that value here in the 00:04:43.512 --> 00:04:46.625 - recurring job options. So that's kind of it. This is for 00:04:46.625 --> 00:04:50.021 - the newer connect, connect V3 and then we just had the video 00:04:50.021 --> 00:04:53.134 - for Kinect V2, so that's kind of it for worker processes.