There really isn’t a straightforward answer to this question—as long as your air conditioner is continuing to work well and isn’t burning through an excessive amount of energy, you might as well keep running it. However, air conditioners do wear out with age, but how long that takes varies from unit to unit. Likewise, a system may appear perfectly healthy one day and completely die the next with little to no warning whatsoever.
As a general rule of thumb, if your air conditioner is still within its expected lifespan, it is probably better to repair the problem. If your air conditioner is older than its expected lifespan and needs a major repair that would probably be money better spent on a replacement, then consider a full, outright replacement.