I don't think either round is going to disappear if that's what you mean by obsolete. 22 Mag has been around forever and fills a valuable rimfire niche with regard to short range power, etc. from 125 yards or less. It can also be shot out of several 22 revolvers for versatility. The 17 HMR isn't going to disappear either and is probably the 2nd most popular rimfire caliber after 22 LR. You won't go wrong with either and could reasonably afford both (always nice to have more guns).
Your decision will probably be more affected by what size varmints you want to shoot and what you mean by long range. The 22 mag obviously has more power but starts losing in the trajectory department much beyond 125 yards. The 17 HMR obviously has frangible ammo if you're concerned about ricochets when shooting at ground squirrels in an alfalfa field. I've found more 17 HMR ammo for sale on store shelves than 22 mag in the current buying frenzy/panic but that scarcity will likely get fixed in the next 2-5 years (probably after the next Presidential election). JMHO and YMMV of course.