I have an example sketch you might find interesting… adjust for your DHT12
It has been running stably on my desk 24/7 for most of the year now.